From 08e26c2ecf65b6e7fa7b100632044ceac6ed338a Mon Sep 17 00:00:00 2001 From: Jason Duell Date: Wed, 8 Sep 2010 17:53:55 -0700 Subject: [PATCH 001/176] Bug 590121 - Null nsHttpResponseHead crashes in redirect. r=dwitte@gmail.com, a=blocking2.0final+ --- netwerk/protocol/http/HttpChannelParentListener.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/netwerk/protocol/http/HttpChannelParentListener.cpp b/netwerk/protocol/http/HttpChannelParentListener.cpp index 24551b4a6bb7..380620a6bb98 100644 --- a/netwerk/protocol/http/HttpChannelParentListener.cpp +++ b/netwerk/protocol/http/HttpChannelParentListener.cpp @@ -220,11 +220,14 @@ HttpChannelParentListener::AsyncOnChannelRedirect( newChannel->GetURI(getter_AddRefs(newURI)); nsHttpChannel *oldHttpChannel = static_cast(oldChannel); + nsHttpResponseHead *responseHead = oldHttpChannel->GetResponseHead(); + // TODO: check mActiveChannel->mIPCClosed and return val from Send function mActiveChannel->SendRedirect1Begin(mRedirectChannel, IPC::URI(newURI), redirectFlags, - *oldHttpChannel->GetResponseHead()); + responseHead ? *responseHead + : nsHttpResponseHead()); // mActiveChannel gets the response in RecvRedirect2Result and forwards it // to this wrapper through OnContentRedirectResultReceived From 77bfcfd3790aae50f03682c30973a527c729d4ed Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Wed, 8 Sep 2010 19:49:31 -0700 Subject: [PATCH 002/176] Mark some of bug 276431's tests as random-on-windows, since they fail on win7, pending investigation. a=orange --- layout/reftests/svg/image/reftest.list | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/layout/reftests/svg/image/reftest.list b/layout/reftests/svg/image/reftest.list index eb86baa33710..2120533d0651 100644 --- a/layout/reftests/svg/image/reftest.list +++ b/layout/reftests/svg/image/reftest.list @@ -26,19 +26,21 @@ include zoom/reftest.list == img-content-outside-viewBox-1.html img-content-outside-viewBox-1-ref.html +# XXXdholbert Some of the tests below fail on Windows 7 right now. Marking them +# random-on-windows right now while I investigate. == img-widthAndHeight-meet-1.html img-widthAndHeight-meet-1-ref.html == img-widthAndHeight-meet-2.html img-widthAndHeight-meet-2-ref.html -== img-widthAndHeight-slice-1.html img-widthAndHeight-slice-1-ref.html -== img-widthAndHeight-slice-2.html img-widthAndHeight-slice-2-ref.html +random-if(winWidget) == img-widthAndHeight-slice-1.html img-widthAndHeight-slice-1-ref.html +random-if(winWidget) == img-widthAndHeight-slice-2.html img-widthAndHeight-slice-2-ref.html -== img-height-meet-1.html img-height-meet-1-ref.html +random-if(winWidget) == img-height-meet-1.html img-height-meet-1-ref.html == img-height-meet-2.html img-height-meet-2-ref.html -== img-height-slice-1.html img-height-slice-1-ref.html +random-if(winWidget) == img-height-slice-1.html img-height-slice-1-ref.html == img-height-slice-2.html img-height-slice-2-ref.html -== img-width-meet-1.html img-width-meet-1-ref.html +random-if(winWidget) == img-width-meet-1.html img-width-meet-1-ref.html == img-width-meet-2.html img-width-meet-2-ref.html -== img-width-slice-1.html img-width-slice-1-ref.html +random-if(winWidget) == img-width-slice-1.html img-width-slice-1-ref.html == img-width-slice-2.html img-width-slice-2-ref.html == list-simple-1.html list-simple-1-ref.html From ef808d052873d74ca9ade337503edcf7f19f6217 Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Wed, 8 Sep 2010 20:37:11 -0700 Subject: [PATCH 003/176] Bug 533038 - 1. Generalize manifest reading code and add api for reading manifests from jars, r=bsmedberg a=blocking-beta6 --- chrome/src/nsChromeRegistry.h | 6 +- chrome/src/nsChromeRegistryChrome.cpp | 7 +- modules/libjar/nsZipArchive.h | 2 + xpcom/build/nsXULAppAPI.h | 21 +++ xpcom/components/Makefile.in | 4 - xpcom/components/ManifestParser.cpp | 10 +- xpcom/components/ManifestParser.h | 7 +- xpcom/components/nsComponentManager.cpp | 173 +++++++++++------- xpcom/components/nsComponentManager.h | 48 ++--- xpcom/components/nsManifestZIPLoader.h | 56 ------ xpcom/tests/TestRegistrationOrder.cpp | 14 +- xpcom/tests/regorder/core/component.manifest | 2 + .../regorder/core/component2.js} | 74 ++++---- xpcom/tests/regorder/extension2.jar | Bin 0 -> 1962 bytes 14 files changed, 212 insertions(+), 212 deletions(-) delete mode 100644 xpcom/components/nsManifestZIPLoader.h rename xpcom/{components/nsManifestZIPLoader.cpp => tests/regorder/core/component2.js} (55%) create mode 100644 xpcom/tests/regorder/extension2.jar diff --git a/chrome/src/nsChromeRegistry.h b/chrome/src/nsChromeRegistry.h index 0905c836879a..37b86db9280b 100644 --- a/chrome/src/nsChromeRegistry.h +++ b/chrome/src/nsChromeRegistry.h @@ -142,13 +142,11 @@ public: , mPath(NULL) { } -#ifdef MOZ_OMNIJAR - ManifestProcessingContext(NSLocationType aType, const char* aPath) + ManifestProcessingContext(NSLocationType aType, nsILocalFile* aFile, const char* aPath) : mType(aType) - , mFile(mozilla::OmnijarPath()) + , mFile(aFile) , mPath(aPath) { } -#endif ~ManifestProcessingContext() { } diff --git a/chrome/src/nsChromeRegistryChrome.cpp b/chrome/src/nsChromeRegistryChrome.cpp index 38381c6b724f..c180a76d498a 100644 --- a/chrome/src/nsChromeRegistryChrome.cpp +++ b/chrome/src/nsChromeRegistryChrome.cpp @@ -78,8 +78,6 @@ #include "nsIXULAppInfo.h" #include "nsIXULRuntime.h" -#include "mozilla/Omnijar.h" - #define UILOCALE_CMD_LINE_ARG "UILocale" #define MATCH_OS_LOCALE_PREF "intl.locale.matchOS" @@ -788,7 +786,6 @@ nsChromeRegistry::ManifestProcessingContext::GetManifestURI() return NULL; } -#ifdef MOZ_OMNIJAR if (mPath) { nsCOMPtr fileURI; io->NewFileURI(mFile, getter_AddRefs(fileURI)); @@ -801,9 +798,7 @@ nsChromeRegistry::ManifestProcessingContext::GetManifestURI() NS_NewURI(getter_AddRefs(mManifestURI), spec, NULL, NULL, io); } - else -#endif - { + else { io->NewFileURI(mFile, getter_AddRefs(mManifestURI)); } } diff --git a/modules/libjar/nsZipArchive.h b/modules/libjar/nsZipArchive.h index d68252173c8d..22a516c2a1c1 100644 --- a/modules/libjar/nsZipArchive.h +++ b/modules/libjar/nsZipArchive.h @@ -46,7 +46,9 @@ #define ZIP_TABSIZE 256 #define ZIP_BUFLEN (4*1024) /* Used as output buffer when deflating items to a file */ +#ifndef PL_ARENA_CONST_ALIGN_MASK #define PL_ARENA_CONST_ALIGN_MASK (sizeof(void*)-1) +#endif #include "plarena.h" #include "zlib.h" diff --git a/xpcom/build/nsXULAppAPI.h b/xpcom/build/nsXULAppAPI.h index 47941aa354ea..ac4d11c3c7fd 100644 --- a/xpcom/build/nsXULAppAPI.h +++ b/xpcom/build/nsXULAppAPI.h @@ -374,6 +374,27 @@ XRE_API(nsresult, XRE_AddManifestLocation, (NSLocationType aType, nsILocalFile* aLocation)) +/** + * Register XPCOM components found in a JAR. + * This is similar to XRE_AddManifestLocation except the file specified + * must be a zip archive with a manifest named chrome.manifest + * This method may be called at any time before or after XRE_main or + * XRE_InitEmbedding. + * + * @param aFiles An array of files or directories. + * @param aFileCount the number of items in the aFiles array. + * @note appdir/components is registered automatically. + * + * NS_COMPONENT_LOCATION specifies a location to search for binary XPCOM + * components as well as component/chrome manifest files. + * + * NS_SKIN_LOCATION specifies a location to search for chrome manifest files + * which are only allowed to register only skin packages and style overlays. + */ +XRE_API(nsresult, + XRE_AddJarManifestLocation, (NSLocationType aType, + nsILocalFile* aLocation)) + /** * Fire notifications to inform the toolkit about a new profile. This * method should be called after XRE_InitEmbedding if the embedder diff --git a/xpcom/components/Makefile.in b/xpcom/components/Makefile.in index eb2f53f529af..e47ea5134db1 100644 --- a/xpcom/components/Makefile.in +++ b/xpcom/components/Makefile.in @@ -68,10 +68,6 @@ CPPSRCS = \ nsNativeComponentLoader.cpp \ $(NULL) -ifdef MOZ_OMNIJAR -CPPSRCS += nsManifestZIPLoader.cpp -endif - SDK_XPIDLSRCS = \ nsIClassInfo.idl \ nsIComponentRegistrar.idl \ diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp index 45c72e84faa0..310f4a332fdf 100644 --- a/xpcom/components/ManifestParser.cpp +++ b/xpcom/components/ManifestParser.cpp @@ -650,14 +650,12 @@ ParseManifest(NSLocationType type, nsILocalFile* file, ParseManifestCommon(type, file, mgrcx, chromecx, NULL, buf, aChromeOnly); } -#ifdef MOZ_OMNIJAR void -ParseManifest(NSLocationType type, const char* jarPath, +ParseManifest(NSLocationType type, nsIZipReader* reader, const char* jarPath, char* buf, bool aChromeOnly) { - nsComponentManagerImpl::ManifestProcessingContext mgrcx(type, jarPath, aChromeOnly); - nsChromeRegistry::ManifestProcessingContext chromecx(type, jarPath); - ParseManifestCommon(type, mozilla::OmnijarPath(), mgrcx, chromecx, jarPath, + nsComponentManagerImpl::ManifestProcessingContext mgrcx(type, reader, jarPath, aChromeOnly); + nsChromeRegistry::ManifestProcessingContext chromecx(type, mgrcx.mFile, jarPath); + ParseManifestCommon(type, mgrcx.mFile, mgrcx, chromecx, jarPath, buf, aChromeOnly); } -#endif diff --git a/xpcom/components/ManifestParser.h b/xpcom/components/ManifestParser.h index 57483339f0ff..58cfab1f28dc 100644 --- a/xpcom/components/ManifestParser.h +++ b/xpcom/components/ManifestParser.h @@ -42,14 +42,13 @@ #include "nsChromeRegistry.h" class nsILocalFile; +class nsIZipReader; void ParseManifest(NSLocationType type, nsILocalFile* file, char* buf, bool aChromeOnly); -#ifdef MOZ_OMNIJAR -void ParseManifest(NSLocationType type, const char* jarPath, - char* buf, bool aChromeOnly); -#endif +void ParseManifest(NSLocationType type, nsIZipReader* reader, + const char* jarPath, char* buf, bool aChromeOnly); void LogMessage(const char* aMsg, ...); diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp index 92356dfc5f51..469a8c168ddc 100644 --- a/xpcom/components/nsComponentManager.cpp +++ b/xpcom/components/nsComponentManager.cpp @@ -106,10 +106,9 @@ #include #endif -#ifdef MOZ_OMNIJAR #include "mozilla/Omnijar.h" +#include "nsJAR.h" static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID); -#endif #include "prlog.h" @@ -353,9 +352,7 @@ nsresult nsComponentManagerImpl::Init() mContractIDs.Init(CONTRACTID_HASHTABLE_INITIAL_SIZE); mLoaderMap.Init(); mKnownFileModules.Init(); -#ifdef MOZ_OMNIJAR mKnownJARModules.Init(); -#endif mMon = nsAutoMonitor::NewMonitor("nsComponentManagerImpl"); if (mMon == nsnull) @@ -372,6 +369,7 @@ nsresult nsComponentManagerImpl::Init() ComponentLocation* cl = sModuleLocations->InsertElementAt(0); cl->type = NS_COMPONENT_LOCATION; cl->location = CloneAndAppend(appDir, NS_LITERAL_CSTRING("chrome.manifest")); + cl->jar = false; PRBool equals = PR_FALSE; appDir->Equals(greDir, &equals); @@ -379,6 +377,7 @@ nsresult nsComponentManagerImpl::Init() cl = sModuleLocations->InsertElementAt(0); cl->type = NS_COMPONENT_LOCATION; cl->location = CloneAndAppend(greDir, NS_LITERAL_CSTRING("chrome.manifest")); + cl->jar = false; } PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, @@ -397,16 +396,36 @@ nsresult nsComponentManagerImpl::Init() RegisterModule((*sStaticModules)[i], NULL); #ifdef MOZ_OMNIJAR - mManifestLoader = new nsManifestZIPLoader(); - - RegisterOmnijar("chrome.manifest", false); + if (mozilla::OmnijarPath()) { + nsCOMPtr omnijarReader = new nsJAR(); + rv = omnijarReader->Open(mozilla::OmnijarPath()); + if (NS_SUCCEEDED(rv)) + RegisterJarManifest(omnijarReader, "chrome.manifest", false); + } #endif for (PRUint32 i = 0; i < sModuleLocations->Length(); ++i) { ComponentLocation& l = sModuleLocations->ElementAt(i); - RegisterManifestFile(l.type, l.location, false); + if (!l.jar) { + RegisterManifestFile(l.type, l.location, false); + continue; + } + + nsCOMPtr reader = do_CreateInstance(kZipReaderCID, &rv); + rv = reader->Open(l.location); + if (NS_SUCCEEDED(rv)) + RegisterJarManifest(reader, "chrome.manifest", false); } +#ifdef MOZ_OMNIJAR + if (mozilla::OmnijarPath()) { + cl = sModuleLocations->InsertElementAt(0); + cl->type = NS_COMPONENT_LOCATION; + cl->location = mozilla::OmnijarPath(); + cl->jar = true; + } +#endif + nsCategoryManager::GetSingleton()->SuppressNotifications(false); mStatus = NORMAL; @@ -522,16 +541,27 @@ GetExtension(nsILocalFile* file) return extension; } -#ifdef MOZ_OMNIJAR -void -nsComponentManagerImpl::RegisterOmnijar(const char* aPath, bool aChromeOnly) +static already_AddRefed +LoadEntry(nsIZipReader* aReader, const char* aName) { - if (!mozilla::OmnijarPath()) - return; + if (!aReader) + return NULL; - nsCOMPtr is = mManifestLoader->LoadEntry(aPath); + nsCOMPtr is; + nsresult rv = aReader->GetInputStream(aName, getter_AddRefs(is)); + if (NS_FAILED(rv)) + return NULL; + + return is.forget(); +} + +void +nsComponentManagerImpl::RegisterJarManifest(nsIZipReader* aReader, + const char* aPath, bool aChromeOnly) +{ + nsCOMPtr is = LoadEntry(aReader, aPath); if (!is) { - LogMessage("Could not find omnijar manifest entry '%s'.", aPath); + LogMessage("Could not find jar manifest entry '%s'.", aPath); return; } @@ -560,9 +590,9 @@ nsComponentManagerImpl::RegisterOmnijar(const char* aPath, bool aChromeOnly) whole[flen] = '\0'; - ParseManifest(NS_COMPONENT_LOCATION, aPath, whole, aChromeOnly); + ParseManifest(NS_COMPONENT_LOCATION, aReader, aPath, + whole, aChromeOnly); } -#endif // MOZ_OMNIJAR namespace { struct AutoCloseFD @@ -636,7 +666,6 @@ TranslateSlashes(char* path) } #endif -#ifdef MOZ_OMNIJAR static void AppendFileToManifestPath(nsCString& path, const char* file) @@ -649,23 +678,19 @@ AppendFileToManifestPath(nsCString& path, path.Append(file); } -#endif void nsComponentManagerImpl::ManifestManifest(ManifestProcessingContext& cx, int lineno, char *const * argv) { char* file = argv[0]; -#ifdef MOZ_OMNIJAR if (cx.mPath) { nsCAutoString manifest(cx.mPath); AppendFileToManifestPath(manifest, file); - RegisterOmnijar(manifest.get(), cx.mChromeOnly); + RegisterJarManifest(cx.mReader, manifest.get(), cx.mChromeOnly); } - else -#endif - { + else { #ifdef TRANSLATE_SLASHES TranslateSlashes(file); #endif @@ -686,14 +711,12 @@ nsComponentManagerImpl::ManifestManifest(ManifestProcessingContext& cx, int line void nsComponentManagerImpl::ManifestBinaryComponent(ManifestProcessingContext& cx, int lineno, char *const * argv) { -#ifdef MOZ_OMNIJAR if (cx.mPath) { - NS_WARNING("Cannot load binary components from the omnijar."); + NS_WARNING("Cannot load binary components from a jar."); LogMessageWithContext(cx.mFile, cx.mPath, lineno, - "Cannot load binary components from the omnijar."); + "Cannot load binary components from a jar."); return; } -#endif char* file = argv[0]; @@ -723,24 +746,21 @@ nsComponentManagerImpl::ManifestXPT(ManifestProcessingContext& cx, int lineno, c { char* file = argv[0]; -#ifdef MOZ_OMNIJAR if (cx.mPath) { nsCAutoString manifest(cx.mPath); AppendFileToManifestPath(manifest, file); nsCOMPtr stream = - mManifestLoader->LoadEntry(manifest.get()); + LoadEntry(cx.mReader, manifest.get()); if (!stream) { - NS_WARNING("Failed to load omnijar XPT file."); + NS_WARNING("Failed to load XPT file in a jar."); return; } xptiInterfaceInfoManager::GetSingleton() ->RegisterInputStream(stream); } - else -#endif - { + else { #ifdef TRANSLATE_SLASHES TranslateSlashes(file); #endif @@ -793,20 +813,22 @@ nsComponentManagerImpl::ManifestComponent(ManifestProcessingContext& cx, int lin KnownModule* km; -#ifdef MOZ_OMNIJAR if (cx.mPath) { nsCAutoString manifest(cx.mPath); AppendFileToManifestPath(manifest, file); - km = mKnownJARModules.Get(manifest); + nsCAutoString hash; + cx.mFile->GetNativePath(hash); + hash.AppendLiteral("|"); + hash.Append(manifest); + + km = mKnownJARModules.Get(hash); if (!km) { - km = new KnownModule(manifest); - mKnownJARModules.Put(manifest, km); + km = new KnownModule(cx.mFile, manifest); + mKnownJARModules.Put(hash, km); } } - else -#endif - { + else { #ifdef TRANSLATE_SLASHES TranslateSlashes(file); #endif @@ -881,13 +903,19 @@ nsComponentManagerImpl::ManifestCategory(ManifestProcessingContext& cx, int line void nsComponentManagerImpl::RereadChromeManifests() { -#ifdef MOZ_OMNIJAR - RegisterOmnijar("chrome.manifest", true); -#endif - for (PRUint32 i = 0; i < sModuleLocations->Length(); ++i) { ComponentLocation& l = sModuleLocations->ElementAt(i); - RegisterManifestFile(l.type, l.location, true); + if (!l.jar) { + RegisterManifestFile(l.type, l.location, true); + continue; + } + + nsresult rv; + nsCOMPtr reader = do_CreateInstance(kZipReaderCID, &rv); + if (NS_SUCCEEDED(rv)) + rv = reader->Open(l.location); + if (NS_SUCCEEDED(rv)) + RegisterJarManifest(reader, "chrome.manifest", true); } } @@ -896,14 +924,11 @@ nsComponentManagerImpl::KnownModule::EnsureLoader() { if (!mLoader) { nsCString extension; -#if MOZ_OMNIJAR if (!mPath.IsEmpty()) { extension = mPath; CutExtension(extension); } - else -#endif - { + else { extension = GetExtension(mFile); } @@ -921,11 +946,9 @@ nsComponentManagerImpl::KnownModule::Load() if (!EnsureLoader()) return false; -#ifdef MOZ_OMNIJAR if (!mPath.IsEmpty()) - mModule = mLoader->LoadModuleFromJAR(mozilla::OmnijarPath(), mPath); + mModule = mLoader->LoadModuleFromJAR(mFile, mPath); else -#endif mModule = mLoader->LoadModule(mFile); if (!mModule) { @@ -950,14 +973,13 @@ nsCString nsComponentManagerImpl::KnownModule::Description() const { nsCString s; -#ifdef MOZ_OMNIJAR if (!mPath.IsEmpty()) { - s.AssignLiteral("omnijar:"); + mFile->GetNativePath(s); + s.Insert(NS_LITERAL_CSTRING("jar:"), 0); + s.AppendLiteral("!/"); s.Append(mPath); } - else -#endif - if (mFile) + else if (mFile) mFile->GetNativePath(s); else s = ""; @@ -979,9 +1001,7 @@ nsresult nsComponentManagerImpl::Shutdown(void) mContractIDs.Clear(); mFactories.Clear(); // XXX release the objects, don't just clear mLoaderMap.Clear(); -#ifdef MOZ_OMNIJAR mKnownJARModules.Clear(); -#endif mKnownFileModules.Clear(); mKnownStaticModules.Clear(); @@ -1199,8 +1219,7 @@ nsComponentManagerImpl::CreateInstance(const nsCID &aClass, rv = NS_ERROR_SERVICE_NOT_FOUND; } } - else - { + else { // Translate error values rv = NS_ERROR_FACTORY_NOT_REGISTERED; } @@ -1287,8 +1306,7 @@ nsComponentManagerImpl::CreateInstanceByContractID(const char *aContractID, rv = NS_ERROR_SERVICE_NOT_FOUND; } } - else - { + else { // Translate error values rv = NS_ERROR_FACTORY_NOT_REGISTERED; } @@ -1992,6 +2010,7 @@ XRE_AddManifestLocation(NSLocationType aType, nsILocalFile* aLocation) nsComponentManagerImpl::sModuleLocations->AppendElement(); c->type = aType; c->location = aLocation; + c->jar = false; if (nsComponentManagerImpl::gComponentManager && nsComponentManagerImpl::NORMAL == nsComponentManagerImpl::gComponentManager->mStatus) @@ -1999,3 +2018,29 @@ XRE_AddManifestLocation(NSLocationType aType, nsILocalFile* aLocation) return NS_OK; } + +EXPORT_XPCOM_API(nsresult) +XRE_AddJarManifestLocation(NSLocationType aType, nsILocalFile* aLocation) +{ + nsComponentManagerImpl::InitializeModuleLocations(); + nsComponentManagerImpl::ComponentLocation* c = + nsComponentManagerImpl::sModuleLocations->AppendElement(); + c->type = aType; + c->location = aLocation; + c->jar = true; + + if (!nsComponentManagerImpl::gComponentManager || + nsComponentManagerImpl::NORMAL != nsComponentManagerImpl::gComponentManager->mStatus) + return NS_OK; + + nsresult rv; + nsCOMPtr reader = do_CreateInstance(kZipReaderCID, &rv); + NS_ENSURE_SUCCESS(rv, rv); + + rv = reader->Open(c->location); + if (NS_SUCCEEDED(rv)) + nsComponentManagerImpl::gComponentManager->RegisterJarManifest(reader, "chrome.manifest", false); + + return NS_OK; +} + diff --git a/xpcom/components/nsComponentManager.h b/xpcom/components/nsComponentManager.h index 3cf8e21e1395..d6eee6c161ea 100644 --- a/xpcom/components/nsComponentManager.h +++ b/xpcom/components/nsComponentManager.h @@ -66,10 +66,8 @@ #include "nsClassHashtable.h" #include "nsTArray.h" -#ifdef MOZ_OMNIJAR #include "mozilla/Omnijar.h" -#include "nsManifestZIPLoader.h" -#endif +#include "nsIZipReader.h" struct nsFactoryEntry; class nsIServiceManager; @@ -91,14 +89,6 @@ extern const char fileSizeValueName[]; extern const char nativeComponentType[]; extern const char staticComponentType[]; -typedef int LoaderType; - -// Predefined loader types. -#define NS_LOADER_TYPE_NATIVE -1 -#define NS_LOADER_TYPE_STATIC -2 -#define NS_LOADER_TYPE_JAR -3 -#define NS_LOADER_TYPE_INVALID -4 - #ifdef DEBUG #define XPCOM_CHECK_PENDING_CIDS #endif @@ -169,10 +159,12 @@ public: { NSLocationType type; nsCOMPtr location; + bool jar; }; static nsTArray* sStaticModules; static nsTArray* sModuleLocations; + static nsTArray* sJarModuleLocations; nsNativeModuleLoader mNativeModuleLoader; @@ -197,16 +189,14 @@ public: , mFailed(false) { } -#ifdef MOZ_OMNIJAR - KnownModule(const nsACString& aPath) + KnownModule(nsILocalFile* aFile, const nsACString& aPath) : mModule(NULL) - , mFile(NULL) + , mFile(aFile) , mPath(aPath) , mLoader(NULL) , mLoaded(false) , mFailed(false) { } -#endif ~KnownModule() { @@ -231,9 +221,7 @@ public: private: const mozilla::Module* mModule; nsCOMPtr mFile; -#ifdef MOZ_OMNIJAR nsCString mPath; -#endif nsCOMPtr mLoader; bool mLoaded; bool mFailed; @@ -243,9 +231,8 @@ public: // referenced by pointer from the factory entries. nsTArray< nsAutoPtr > mKnownStaticModules; nsClassHashtable mKnownFileModules; -#ifdef MOZ_OMNIJAR + // The key is a string in this format "|" nsClassHashtable mKnownJARModules; -#endif void RegisterModule(const mozilla::Module* aModule, nsILocalFile* aFile); @@ -253,9 +240,8 @@ public: KnownModule* aModule); void RegisterContractID(const mozilla::Module::ContractIDEntry* aEntry); -#ifdef MOZ_OMNIJAR - void RegisterOmnijar(const char* aPath, bool aChromeOnly); -#endif + void RegisterJarManifest(nsIZipReader* aReader, + const char* aPath, bool aChromeOnly); void RegisterManifestFile(NSLocationType aType, nsILocalFile* aFile, bool aChromeOnly); @@ -269,19 +255,23 @@ public: , mChromeOnly(aChromeOnly) { } -#ifdef MOZ_OMNIJAR - ManifestProcessingContext(NSLocationType aType, const char* aPath, bool aChromeOnly) + ManifestProcessingContext(NSLocationType aType, nsIZipReader* aReader, const char* aPath, bool aChromeOnly) : mType(aType) - , mFile(mozilla::OmnijarPath()) + , mReader(aReader) , mPath(aPath) , mChromeOnly(aChromeOnly) - { } -#endif + { + nsCOMPtr file; + aReader->GetFile(getter_AddRefs(file)); + nsCOMPtr localfile = do_QueryInterface(file); + mFile = localfile; + } ~ManifestProcessingContext() { } NSLocationType mType; nsILocalFile* mFile; + nsIZipReader* mReader; const char* mPath; bool mChromeOnly; }; @@ -321,10 +311,6 @@ public: private: ~nsComponentManagerImpl(); - -#ifdef MOZ_OMNIJAR - nsAutoPtr mManifestLoader; -#endif }; diff --git a/xpcom/components/nsManifestZIPLoader.h b/xpcom/components/nsManifestZIPLoader.h deleted file mode 100644 index 658d9ce06e9f..000000000000 --- a/xpcom/components/nsManifestZIPLoader.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the XPT zip reader. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corp. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * John Bandhauer - * Alec Flett - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsCOMPtr.h" - -#include "nsIZipReader.h" -#include "nsIInputStream.h" - -class nsManifestZIPLoader -{ - public: - nsManifestZIPLoader(); - ~nsManifestZIPLoader(); - - already_AddRefed LoadEntry(const char* name); - - private: - nsCOMPtr mZipReader; -}; - diff --git a/xpcom/tests/TestRegistrationOrder.cpp b/xpcom/tests/TestRegistrationOrder.cpp index 99fcfd0440a0..59c5bfd990a3 100644 --- a/xpcom/tests/TestRegistrationOrder.cpp +++ b/xpcom/tests/TestRegistrationOrder.cpp @@ -133,6 +133,12 @@ nsresult TestRegular() kCoreServiceA_CID, kExtServiceA_CID); } +nsresult TestJar() +{ + return execRegOrderTest("TestJar", SERVICE_B_CONTRACT_ID, + kCoreServiceB_CID, kExtServiceB_CID); +} + bool TestContractFirst() { nsCOMPtr r; @@ -167,7 +173,8 @@ GetRegDirectory(const char* basename, const char* dirname, const char* leafname) return NULL; f->AppendNative(nsDependentCString(dirname)); - f->AppendNative(nsDependentCString(leafname)); + if (leafname) + f->AppendNative(nsDependentCString(leafname)); return f.forget(); } @@ -188,6 +195,8 @@ int main(int argc, char** argv) nsCOMPtr(GetRegDirectory(regPath, "core", "component.manifest"))); XRE_AddManifestLocation(NS_COMPONENT_LOCATION, nsCOMPtr(GetRegDirectory(regPath, "extension", "extComponent.manifest"))); + XRE_AddJarManifestLocation(NS_COMPONENT_LOCATION, + nsCOMPtr(GetRegDirectory(regPath, "extension2.jar", NULL))); ScopedXPCOM xpcom("RegistrationOrder"); if (xpcom.failed()) return 1; @@ -196,6 +205,9 @@ int main(int argc, char** argv) if (NS_FAILED(TestRegular())) rv = 1; + if (NS_FAILED(TestJar())) + rv = 1; + if (!TestContractFirst()) rv = 1; diff --git a/xpcom/tests/regorder/core/component.manifest b/xpcom/tests/regorder/core/component.manifest index 95b95dc5c428..9e11a7352c85 100644 --- a/xpcom/tests/regorder/core/component.manifest +++ b/xpcom/tests/regorder/core/component.manifest @@ -1,5 +1,7 @@ component {56ab1cd4-ac44-4f86-8104-171f8b8f2fc7} component.js +component {d04d1298-6dac-459b-a13b-bcab235730a0} component2.js contract @mozilla.org/RegTestServiceA;1 {56ab1cd4-ac44-4f86-8104-171f8b8f2fc7} +contract @mozilla.org/RegTestServiceB;1 {d04d1298-6dac-459b-a13b-bcab235730a0} contract @mozilla.org/RegTestOrderC;1 {ada15884-bb89-473c-8b50-dcfbb8447ff4} component {ada15884-bb89-473c-8b50-dcfbb8447ff4} missing.js diff --git a/xpcom/components/nsManifestZIPLoader.cpp b/xpcom/tests/regorder/core/component2.js similarity index 55% rename from xpcom/components/nsManifestZIPLoader.cpp rename to xpcom/tests/regorder/core/component2.js index f5814390254e..a9c897d6702c 100644 --- a/xpcom/components/nsManifestZIPLoader.cpp +++ b/xpcom/tests/regorder/core/component2.js @@ -1,4 +1,5 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et: */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -12,20 +13,19 @@ * for the specific language governing rights and limitations under the * License. * - * The Original Code is the XPT zip reader. + * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is - * Netscape Communications Corp. - * Portions created by the Initial Developer are Copyright (C) 2002 + * Kathleen Brade + * Mark Smith + * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): - * John Bandhauer - * Alec Flett * * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to @@ -37,33 +37,35 @@ * * ***** END LICENSE BLOCK ***** */ - -#include "nsManifestZIPLoader.h" -#include "nsJAR.h" -#include "mozilla/Omnijar.h" - -nsManifestZIPLoader::nsManifestZIPLoader() - : mZipReader(new nsJAR()) +var gRegTestCoreComponent = { - nsresult rv = mZipReader->Open(mozilla::OmnijarPath()); - if (NS_FAILED(rv)) - mZipReader = NULL; -} - -nsManifestZIPLoader::~nsManifestZIPLoader() -{ -} - -already_AddRefed -nsManifestZIPLoader::LoadEntry(const char* aName) -{ - if (!mZipReader) - return NULL; - - nsCOMPtr is; - nsresult rv = mZipReader->GetInputStream(aName, getter_AddRefs(is)); - if (NS_FAILED(rv)) - return NULL; - - return is.forget(); + /* nsISupports implementation. */ + QueryInterface: function (aIID) + { + if (!aIID.equals(Components.interfaces.nsISupports) && + !aIID.equals(Components.interfaces.nsIFactory)) + throw Components.results.NS_ERROR_NO_INTERFACE; + + return this; + }, + + /* nsIFactory implementation. */ + createInstance: function (aOuter, aIID) + { + if (null != aOuter) + throw Components.results.NS_ERROR_NO_AGGREGATION; + + return this.QueryInterface(aIID); + }, + + lockFactory: function (aDoLock) {} +}; + +const kClassID = Components.ID("{d04d1298-6dac-459b-a13b-bcab235730a0}"); + +function NSGetFactory(aClassID) { + if (!aClassID.equals(kClassID)) + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + + return gRegTestCoreComponent; } diff --git a/xpcom/tests/regorder/extension2.jar b/xpcom/tests/regorder/extension2.jar new file mode 100644 index 0000000000000000000000000000000000000000..fcab893f6aebd7e57b50dc81d24cc7b90725340b GIT binary patch literal 1962 zcmaKtX;70_6ox+_s0p%&K}0ZURknn%1QevSp#qYP$`TqDWs!i1QiGz zPzKfk7?z$RAKqiO3jhE!Ff;)j;P4Sv1f7be2Qz44RCW~E8w#kf(xQoqAafwV3zbkn zOllVs3Fc@Iw+a(n2ePxh3)8dKS|DSqy^(p!@N=vJm=HJsmVtp#0B8ftEIZpWQl6s?`AU8uT6gpWn=7}+u$agLA(J}X2`c6G9A5vQ@(Ht6X z6srC3KKL)AZ%v(amYnHAp1SbYm%q`Ney_V_D7zc)WER&$pT9CyVn!1UN2RA_x`>wW_s53(B?J^+L@Dtt!2y)&XA3fCImg1_c z?DvHAahX;%JGCPz#fccb9k+x62h>`xYY=8&P}xIk>+t7Ux7iQ;kwN_n9Tg;f`Qp(U z*e3f??4++Cxl9*#zE65PfD7H@BQvSKgmt~xbCM}y4PZSe(ESxw$$#u%$}ue(Q~q`f z^!aGz5x*jjW0v<)M{Vz}dB@zSvA5-?9QDy>hs(ROL|cSn_ywRj?dMs8e(y0jF~jOA zuQ{>Rw>fMbrpDR)UVg%OwY|=nRtO}JDMqD79GZ8?Kg)0+BY1|nL@fW2WUO|F#*NFb z^ip~L?zLM33J;hn>3Y_?Mr!P7?^G>JMs~ay%YEp`C1uk#c=d=xYrIDS^QX*vM}mpB zCT6G`_=c2WQ-QIIaXZbh;?!K--2j~-DeMs3qz=i9VZAxt`%T0vl_OB4qJYK?Tcm_? z=WGstyg}E0vg(FSMxA*uj-!2fTYn4U?M#F4ZKfo8o`K1hJlT*;?}Yx%hR_cflK{gMbxSC4puH&~PUc>{C>t4%sStzlN6C)bh+ zps>4)y@9w1)tMZd(!{1iLn$MXPjb>c1qON5v&7h8+a*EdduyPQH*Cf?xmp#Tz@LsM zB^7UPxO6=~Z=mj_gJ|$4x;%*Y_O{58rs08XHm<*UKdG~T-!>dxva8opfAq)1<`_dd zpP~G~_;hZ`b!}icwkP=y6p3cKx!y6-sf9bGs-g7s{CfG`;sU7`PpH&OY@XiShFb5S zQ^j-x;$UN%(`4*@>)^JbAfu=Hu^V5BZZ@=>f6{mA$;63{kVo5I;!9?#*(8$iu=@~t zu2~lrm#Zxh zeBJxc_7Zw#qcF90-NAFmJ!j93^OLxA*e_6D_#4L)M8tP_snhh_^516@;VgqcUx!WJ zo3r>RdNoWv$3y)g1>vA%W`VKoe?)JURF{Gps)!HLN9gP_f7nInKzfw9*Vwq@h&WOY z$%cUGwY9=v21s~3zMn*_b=ys_va)iswk{)sk{)?_vRiC6j_>S3n&OFQ59Y&;%C`1a zoK$RqAJD{;G;!u=sJpqDnCKo|wR>j|2Mvn7lCrMKms~}CS@@N}yEsAd{LEuiS3HKy z0sbR>$v9R>0H6g-IVond%0@tn!bUz)zGNVu_EWN&@|m50&=o8B(Ao<0^96kh%~M^~ c+A8SBb%E%WRVmP_YZQ}#fCmc>%6s|uFF%zc=l}o! literal 0 HcmV?d00001 From 530165f48ea5d161ea731340e0e3b706d584b404 Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Wed, 8 Sep 2010 20:37:34 -0700 Subject: [PATCH 004/176] Bug 533038 - 2. Generalize nsZipArchive and nsZipHandle to read from different sources, r=taras a=blocking-beta6 --- modules/libjar/nsJARInputStream.cpp | 2 +- modules/libjar/nsZipArchive.cpp | 88 +++++++++++++++++++---------- modules/libjar/nsZipArchive.h | 65 ++++++++++++--------- startupcache/StartupCache.cpp | 2 +- 4 files changed, 99 insertions(+), 58 deletions(-) diff --git a/modules/libjar/nsJARInputStream.cpp b/modules/libjar/nsJARInputStream.cpp index 838aebe54b40..f6a5d5f20875 100644 --- a/modules/libjar/nsJARInputStream.cpp +++ b/modules/libjar/nsJARInputStream.cpp @@ -88,7 +88,7 @@ nsJARInputStream::InitFile(nsJAR *aJar, nsZipItem *item) // Must keep handle to filepointer and mmap structure as long as we need access to the mmapped data mFd = aJar->mZip.GetFD(); - mZs.next_in = aJar->mZip.GetData(item); + mZs.next_in = (Bytef *)aJar->mZip.GetData(item); if (!mZs.next_in) return NS_ERROR_FILE_CORRUPTED; mZs.avail_in = item->Size(); diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index 9af569214cbb..a40080914ab1 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -175,8 +175,13 @@ nsZipHandle::nsZipHandle() NS_IMPL_THREADSAFE_ADDREF(nsZipHandle) NS_IMPL_THREADSAFE_RELEASE(nsZipHandle) -nsresult nsZipHandle::Init(PRFileDesc *fd, nsZipHandle **ret) +nsresult nsZipHandle::Init(nsILocalFile *file, nsZipHandle **ret) { + mozilla::AutoFDClose fd; + nsresult rv = file->OpenNSPRFileDesc(PR_RDONLY, 0000, &fd); + if (NS_FAILED(rv)) + return rv; + PRInt64 size = PR_Available64(fd); if (size >= PR_INT32_MAX) return NS_ERROR_FILE_TOO_BIG; @@ -192,7 +197,7 @@ nsresult nsZipHandle::Init(PRFileDesc *fd, nsZipHandle **ret) return NS_ERROR_FAILURE; } - nsZipHandle *handle = new nsZipHandle(); + nsRefPtr handle = new nsZipHandle(); if (!handle) { PR_MemUnmap(buf, size); PR_CloseFileMap(map); @@ -200,21 +205,40 @@ nsresult nsZipHandle::Init(PRFileDesc *fd, nsZipHandle **ret) } handle->mMap = map; + handle->mFile = file; handle->mLen = (PRUint32) size; handle->mFileData = buf; - handle->AddRef(); - *ret = handle; + *ret = handle.forget().get(); + return NS_OK; +} + +nsresult nsZipHandle::Init(nsZipArchive *zip, const char *entry, + nsZipHandle **ret) +{ + nsRefPtr handle = new nsZipHandle(); + if (!handle) + return NS_ERROR_OUT_OF_MEMORY; + + handle->mBuf = new nsZipItemPtr(zip, entry); + if (!handle->mBuf) + return NS_ERROR_OUT_OF_MEMORY; + + handle->mMap = nsnull; + handle->mLen = handle->mBuf->Length(); + handle->mFileData = handle->mBuf->Buffer(); + *ret = handle.forget().get(); return NS_OK; } nsZipHandle::~nsZipHandle() { - if (mFileData) { - PR_MemUnmap(mFileData, mLen); + if (mMap) { + PR_MemUnmap((void *)mFileData, mLen); PR_CloseFileMap(mMap); - mFileData = nsnull; - mMap = nsnull; } + mFileData = nsnull; + mMap = nsnull; + mBuf = nsnull; MOZ_COUNT_DTOR(nsZipHandle); } @@ -225,28 +249,17 @@ nsZipHandle::~nsZipHandle() //--------------------------------------------- // nsZipArchive::OpenArchive //--------------------------------------------- -nsresult nsZipArchive::OpenArchive(nsIFile *aZipFile) +nsresult nsZipArchive::OpenArchive(nsZipHandle *aZipHandle) { - nsresult rv; - nsCOMPtr localFile = do_QueryInterface(aZipFile, &rv); - if (NS_FAILED(rv)) return rv; - - PRFileDesc* fd; - rv = localFile->OpenNSPRFileDesc(PR_RDONLY, 0000, &fd); - if (NS_FAILED(rv)) return rv; - - rv = nsZipHandle::Init(fd, getter_AddRefs(mFd)); - PR_Close(fd); - if (NS_FAILED(rv)) - return rv; + mFd = aZipHandle; // Initialize our arena PL_INIT_ARENA_POOL(&mArena, "ZipArena", ZIP_ARENABLOCKSIZE); //-- get table of contents for archive - rv = BuildFileList(); + nsresult rv = BuildFileList(); char *env = PR_GetEnv("MOZ_JAR_LOG_DIR"); - if (env && NS_SUCCEEDED(rv)) { + if (env && NS_SUCCEEDED(rv) && aZipHandle->mFile) { nsCOMPtr logFile; nsresult rv2 = NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), PR_FALSE, getter_AddRefs(logFile)); @@ -257,10 +270,11 @@ nsresult nsZipArchive::OpenArchive(nsIFile *aZipFile) logFile->Create(nsIFile::DIRECTORY_TYPE, 0700); nsAutoString name; - localFile->GetLeafName(name); + aZipHandle->mFile->GetLeafName(name); name.Append(NS_LITERAL_STRING(".log")); logFile->Append(name); + PRFileDesc* fd; rv2 = logFile->OpenNSPRFileDesc(PR_WRONLY|PR_CREATE_FILE|PR_APPEND, 0644, &fd); if (NS_SUCCEEDED(rv2)) mLog = fd; @@ -268,6 +282,20 @@ nsresult nsZipArchive::OpenArchive(nsIFile *aZipFile) return rv; } +nsresult nsZipArchive::OpenArchive(nsIFile *aFile) +{ + nsresult rv; + nsCOMPtr localFile = do_QueryInterface(aFile, &rv); + NS_ENSURE_SUCCESS(rv, rv); + + nsRefPtr handle; + rv = nsZipHandle::Init(localFile, getter_AddRefs(handle)); + if (NS_FAILED(rv)) + return rv; + + return OpenArchive(handle); +} + //--------------------------------------------- // nsZipArchive::Test //--------------------------------------------- @@ -562,9 +590,9 @@ nsresult nsZipArchive::BuildFileList() NS_TIME_FUNCTION; // Get archive size using end pos - PRUint8* buf; - PRUint8* startp = mFd->mFileData; - PRUint8* endp = startp + mFd->mLen; + const PRUint8* buf; + const PRUint8* startp = mFd->mFileData; + const PRUint8* endp = startp + mFd->mLen; PRUint32 centralOffset = 1; if (mFd->mLen > ZIPCENTRAL_SIZE && *(PRUint32*)(startp + centralOffset) == CENTRALSIG) { @@ -706,13 +734,13 @@ nsZipHandle* nsZipArchive::GetFD() //--------------------------------------------- // nsZipArchive::GetData //--------------------------------------------- -PRUint8* nsZipArchive::GetData(nsZipItem* aItem) +const PRUint8* nsZipArchive::GetData(nsZipItem* aItem) { PR_ASSERT (aItem); //-- read local header to get variable length values and calculate //-- the real data offset PRUint32 len = mFd->mLen; - PRUint8* data = mFd->mFileData; + const PRUint8* data = mFd->mFileData; PRUint32 offset = aItem->LocalOffset(); if (offset + ZIPLOCAL_SIZE > len) return nsnull; @@ -737,7 +765,7 @@ PRUint8* nsZipArchive::GetData(nsZipItem* aItem) } PRBool -nsZipArchive::CheckCRC(nsZipItem* aItem, PRUint8* aItemData) { +nsZipArchive::CheckCRC(nsZipItem* aItem, const PRUint8* aItemData) { PRUint32 crc = crc32(0, (const unsigned char*)aItemData, aItem->Size()); return crc == aItem->CRC32(); } diff --git a/modules/libjar/nsZipArchive.h b/modules/libjar/nsZipArchive.h index 22a516c2a1c1..63233018782a 100644 --- a/modules/libjar/nsZipArchive.h +++ b/modules/libjar/nsZipArchive.h @@ -133,10 +133,20 @@ public: * object. If we were allowed to use exceptions this would have been * part of the constructor * - * @param fd File descriptor of file to open + * @param aZipHandle The nsZipHandle used to access the zip * @return status code */ - nsresult OpenArchive(nsIFile *aZipFile); + nsresult OpenArchive(nsZipHandle *aZipHandle); + + /** + * OpenArchive + * + * Convenience function that generates nsZipHandle + * + * @param aFile The file used to access the zip + * @return status code + */ + nsresult OpenArchive(nsIFile *aFile); /** * Test the integrity of items in this archive by running @@ -196,9 +206,9 @@ public: * @param aItem Pointer to nsZipItem * reutrns null when zip file is corrupt. */ - PRUint8* GetData(nsZipItem* aItem); + const PRUint8* GetData(nsZipItem* aItem); - PRBool CheckCRC(nsZipItem* aItem, PRUint8* aData); + PRBool CheckCRC(nsZipItem* aItem, const PRUint8* aData); private: //--- private members --- @@ -225,27 +235,6 @@ private: nsresult BuildSynthetics(); }; -class nsZipHandle { -friend class nsZipArchive; -public: - static nsresult Init(PRFileDesc *fd, nsZipHandle **ret NS_OUTPARAM); - - NS_METHOD_(nsrefcnt) AddRef(void); - NS_METHOD_(nsrefcnt) Release(void); - -protected: - PRUint8 * mFileData; /* pointer to mmaped file */ - PRUint32 mLen; /* length of file and memory mapped area */ - -private: - nsZipHandle(); - ~nsZipHandle(); - - PRFileMap * mMap; /* nspr datastructure for mmap */ - nsrefcnt mRefCnt; /* ref count */ -}; - - /** * nsZipFind * @@ -308,7 +297,7 @@ private: bool mDoCRC; }; -/** +/** * nsZipItemPtr - a RAII convenience class for reading the individual items in a zip. * It reads whole files and does zero-copy IO for stored files. A buffer is allocated * for decompression. @@ -353,6 +342,30 @@ public: } }; +class nsZipHandle { +friend class nsZipArchive; +public: + static nsresult Init(nsILocalFile *file, nsZipHandle **ret NS_OUTPARAM); + static nsresult Init(nsZipArchive *zip, const char *entry, + nsZipHandle **ret NS_OUTPARAM); + + NS_METHOD_(nsrefcnt) AddRef(void); + NS_METHOD_(nsrefcnt) Release(void); + +protected: + const PRUint8 * mFileData; /* pointer to mmaped file */ + PRUint32 mLen; /* length of file and memory mapped area */ + nsCOMPtr mFile; /* source file if any, for logging */ + +private: + nsZipHandle(); + ~nsZipHandle(); + + PRFileMap * mMap; /* nspr datastructure for mmap */ + nsAutoPtr > mBuf; + nsrefcnt mRefCnt; /* ref count */ +}; + nsresult gZlibInit(z_stream *zs); #endif /* nsZipArchive_h_ */ diff --git a/startupcache/StartupCache.cpp b/startupcache/StartupCache.cpp index 5995b9f6344f..1c675c81bc99 100644 --- a/startupcache/StartupCache.cpp +++ b/startupcache/StartupCache.cpp @@ -224,7 +224,7 @@ StartupCache::GetBuffer(const char* id, char** outbuf, PRUint32* length) if (!data && mArchive) { nsZipItem* zipItem = mArchive->GetItem(id); if (zipItem) { - PRUint8* itemData = mArchive->GetData(zipItem); + const PRUint8* itemData = mArchive->GetData(zipItem); if (!itemData || !mArchive->CheckCRC(zipItem, itemData)) { NS_WARNING("StartupCache file corrupted!"); InvalidateCache(); From 1c5226fb0ee87efa851753ad17e3c198e93b2760 Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Wed, 8 Sep 2010 20:38:12 -0700 Subject: [PATCH 005/176] Bug 533038 - 3. Support reading preferences from arbitrary jars, r=dwitte a=blocking-beta6 --- modules/libpref/public/nsIPrefService.idl | 19 +++++++- modules/libpref/src/nsPrefService.cpp | 59 +++++++++++++++++++++++ modules/libpref/src/nsPrefService.h | 2 + 3 files changed, 79 insertions(+), 1 deletion(-) diff --git a/modules/libpref/public/nsIPrefService.idl b/modules/libpref/public/nsIPrefService.idl index cc1745626cf6..576d28d1fe77 100644 --- a/modules/libpref/public/nsIPrefService.idl +++ b/modules/libpref/public/nsIPrefService.idl @@ -41,6 +41,7 @@ #include "nsIPrefBranch.idl" interface nsIFile; +interface nsILocalFile; /** * The nsIPrefService interface is the main entry point into the back end @@ -105,7 +106,6 @@ interface nsIPrefService : nsISupports */ void savePrefFile(in nsIFile aFile); - /** * Call to get a Preferences "Branch" which accesses user preference data. * Using a Set method on this object will always create or set a user @@ -153,6 +153,23 @@ interface nsIPrefService : nsISupports }; +[scriptable, uuid(00162579-0687-478d-8a52-f49714d4c1be)] +interface nsIPrefServiceInternal : nsISupports +{ + /** + * Called to read the preferences in the defaults/preferences/ + * directory of a zip file + * + * @param aFile The zip file to be read. + * + * @return NS_OK The file was read and processed. + * @return Other The file failed to read or contained invalid data. + * + * @see readUserPrefs + */ + void readExtensionPrefs(in nsILocalFile aFile); +}; + %{C++ #define NS_PREFSERVICE_CID \ diff --git a/modules/libpref/src/nsPrefService.cpp b/modules/libpref/src/nsPrefService.cpp index 488d0e63a7e2..72699b0392b3 100644 --- a/modules/libpref/src/nsPrefService.cpp +++ b/modules/libpref/src/nsPrefService.cpp @@ -48,8 +48,11 @@ #include "nsCategoryManagerUtils.h" #include "nsNetUtil.h" #include "nsIFile.h" +#include "nsIInputStream.h" #include "nsILocalFile.h" #include "nsIObserverService.h" +#include "nsIStringEnumerator.h" +#include "nsIZipReader.h" #include "nsPrefBranch.h" #include "nsXPIDLString.h" #include "nsCRT.h" @@ -74,6 +77,7 @@ // Definitions #define INITIAL_PREF_FILES 10 +static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID); // Prototypes static nsresult openPrefFile(nsIFile* aFile); @@ -106,6 +110,7 @@ NS_IMPL_THREADSAFE_RELEASE(nsPrefService) NS_INTERFACE_MAP_BEGIN(nsPrefService) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrefService) NS_INTERFACE_MAP_ENTRY(nsIPrefService) + NS_INTERFACE_MAP_ENTRY(nsIPrefServiceInternal) NS_INTERFACE_MAP_ENTRY(nsIObserver) NS_INTERFACE_MAP_ENTRY(nsIPrefBranch) NS_INTERFACE_MAP_ENTRY(nsIPrefBranch2) @@ -173,6 +178,11 @@ nsresult nsPrefService::Init() NS_IMETHODIMP nsPrefService::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) { +#ifdef MOZ_IPC + if (XRE_GetProcessType() == GeckoProcessType_Content) + return NS_ERROR_NOT_AVAILABLE; +#endif + nsresult rv = NS_OK; if (!nsCRT::strcmp(aTopic, "profile-before-change")) { @@ -263,6 +273,55 @@ NS_IMETHODIMP nsPrefService::SavePrefFile(nsIFile *aFile) return SavePrefFileInternal(aFile); } +/* part of nsIPrefServiceInternal */ +NS_IMETHODIMP nsPrefService::ReadExtensionPrefs(nsILocalFile *aFile) +{ + nsresult rv; + nsCOMPtr reader = do_CreateInstance(kZipReaderCID, &rv); + NS_ENSURE_SUCCESS(rv, rv); + + rv = reader->Open(aFile); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr files; + rv = reader->FindEntries("defaults/preferences/*.(J|j)(S|s)$", + getter_AddRefs(files)); + NS_ENSURE_SUCCESS(rv, rv); + + char buffer[4096]; + + PRBool more; + while (NS_SUCCEEDED(rv = files->HasMore(&more)) && more) { + nsCAutoString entry; + rv = files->GetNext(entry); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr stream; + rv = reader->GetInputStream(entry.get(), getter_AddRefs(stream)); + NS_ENSURE_SUCCESS(rv, rv); + + PRUint32 avail, read; + + PrefParseState ps; + PREF_InitParseState(&ps, PREF_ReaderCallback, NULL); + while (NS_SUCCEEDED(rv = stream->Available(&avail)) && avail) { + rv = stream->Read(buffer, 4096, &read); + if (NS_FAILED(rv)) { + NS_WARNING("Pref stream read failed"); + break; + } + + rv = PREF_ParseBuf(&ps, buffer, read); + if (NS_FAILED(rv)) { + NS_WARNING("Pref stream parse failed"); + break; + } + } + PREF_FinalizeParseState(&ps); + } + return rv; +} + NS_IMETHODIMP nsPrefService::GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval) { nsresult rv; diff --git a/modules/libpref/src/nsPrefService.h b/modules/libpref/src/nsPrefService.h index 2ed87c8dd59d..9cab286bfac0 100644 --- a/modules/libpref/src/nsPrefService.h +++ b/modules/libpref/src/nsPrefService.h @@ -50,6 +50,7 @@ class nsIFile; class nsPrefService : public nsIPrefService, + public nsIPrefServiceInternal, public nsIObserver, public nsIPrefBranchInternal, public nsSupportsWeakReference @@ -57,6 +58,7 @@ class nsPrefService : public nsIPrefService, public: NS_DECL_ISUPPORTS NS_DECL_NSIPREFSERVICE + NS_DECL_NSIPREFSERVICEINTERNAL NS_FORWARD_NSIPREFBRANCH(mRootBranch->) NS_FORWARD_NSIPREFBRANCH2(mRootBranch->) NS_DECL_NSIOBSERVER From d0ae6e2d03b350ce110542bbf60eb187af09a093 Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Wed, 8 Sep 2010 20:38:34 -0700 Subject: [PATCH 006/176] Bug 533038 - 4. Fully support reading jars inside jars, r=taras a=blocking-beta6 --- modules/libjar/nsIZipReader.idl | 14 ++++- modules/libjar/nsJAR.cpp | 107 +++++++++++++++++++++++++++++--- modules/libjar/nsJAR.h | 3 + modules/libjar/nsJARChannel.cpp | 68 ++++++++++++++------ modules/libjar/nsJARChannel.h | 1 + 5 files changed, 164 insertions(+), 29 deletions(-) diff --git a/modules/libjar/nsIZipReader.idl b/modules/libjar/nsIZipReader.idl index 47f8e50b77d2..aae3fa01b516 100644 --- a/modules/libjar/nsIZipReader.idl +++ b/modules/libjar/nsIZipReader.idl @@ -91,7 +91,7 @@ interface nsIZipEntry : nsISupports readonly attribute boolean isSynthetic; }; -[scriptable, uuid(27067432-cb21-437e-99d1-f85858522bb1)] +[scriptable, uuid(7bb925d6-833a-486c-8ef2-9bc15c670a60)] interface nsIZipReader : nsISupports { /** @@ -101,6 +101,11 @@ interface nsIZipReader : nsISupports */ void open(in nsIFile zipFile); + /** + * Opens a zip file inside a zip file for reading. + */ + void openInner(in nsIZipReader zipReader, in string zipEntry); + /** * The file that represents the zip with which this zip reader was * initialized. @@ -240,6 +245,13 @@ interface nsIZipReaderCache : nsISupports * will return the closed zip reader. */ nsIZipReader getZip(in nsIFile zipFile); + + /** + * Returns a (possibly shared) nsIZipReader for a zip inside another zip + * + * See getZip + */ + nsIZipReader getInnerZip(in nsIFile zipFile, in string zipEntry); }; //////////////////////////////////////////////////////////////////////////////// diff --git a/modules/libjar/nsJAR.cpp b/modules/libjar/nsJAR.cpp index 8a84bdf8a550..a9cdc0cd37f7 100644 --- a/modules/libjar/nsJAR.cpp +++ b/modules/libjar/nsJAR.cpp @@ -173,6 +173,30 @@ nsJAR::Open(nsIFile* zipFile) return mZip.OpenArchive(zipFile); } +NS_IMETHODIMP +nsJAR::OpenInner(nsIZipReader *aZipReader, const char *aZipEntry) +{ + NS_ENSURE_ARG_POINTER(aZipReader); + NS_ENSURE_ARG_POINTER(aZipEntry); + if (mLock) return NS_ERROR_FAILURE; // Already open! + + nsresult rv = aZipReader->GetFile(getter_AddRefs(mZipFile)); + NS_ENSURE_SUCCESS(rv, rv); + + mLock = PR_NewLock(); + NS_ENSURE_TRUE(mLock, NS_ERROR_OUT_OF_MEMORY); + + mOuterZipEntry.Assign(aZipEntry); + + nsRefPtr handle; + rv = nsZipHandle::Init(&static_cast(aZipReader)->mZip, aZipEntry, + getter_AddRefs(handle)); + if (NS_FAILED(rv)) + return rv; + + return mZip.OpenArchive(handle); +} + NS_IMETHODIMP nsJAR::GetFile(nsIFile* *result) { @@ -193,6 +217,7 @@ nsJAR::Close() mManifestData.Reset(); mGlobalStatus = JAR_MANIFEST_NOT_PARSED; mTotalItemsInManifest = 0; + mOuterZipEntry.Truncate(0); return mZip.CloseArchive(); } @@ -1001,8 +1026,8 @@ nsJARItem::GetLastModifiedTime(PRTime* aLastModTime) NS_IMPL_THREADSAFE_ISUPPORTS3(nsZipReaderCache, nsIZipReaderCache, nsIObserver, nsISupportsWeakReference) nsZipReaderCache::nsZipReaderCache() - : mLock(nsnull), - mZips(16) + : mLock(nsnull) + , mZips(16) #ifdef ZIP_CACHE_HIT_RATE , mZipCacheLookups(0), @@ -1066,11 +1091,13 @@ nsZipReaderCache::GetZip(nsIFile* zipFile, nsIZipReader* *result) mZipCacheLookups++; #endif - nsCAutoString path; - rv = zipFile->GetNativePath(path); + nsCAutoString uri; + rv = zipFile->GetNativePath(uri); if (NS_FAILED(rv)) return rv; - nsCStringKey key(path); + uri.Insert(NS_LITERAL_CSTRING("file:"), 0); + + nsCStringKey key(uri); nsJAR* zip = static_cast(static_cast(mZips.Get(&key))); // AddRefs if (zip) { #ifdef ZIP_CACHE_HIT_RATE @@ -1098,6 +1125,56 @@ nsZipReaderCache::GetZip(nsIFile* zipFile, nsIZipReader* *result) return rv; } +NS_IMETHODIMP +nsZipReaderCache::GetInnerZip(nsIFile* zipFile, const char *entry, + nsIZipReader* *result) +{ + NS_ENSURE_ARG_POINTER(zipFile); + + nsCOMPtr outerZipReader; + nsresult rv = GetZip(zipFile, getter_AddRefs(outerZipReader)); + NS_ENSURE_SUCCESS(rv, rv); + +#ifdef ZIP_CACHE_HIT_RATE + mZipCacheLookups++; +#endif + + nsCAutoString uri; + rv = zipFile->GetNativePath(uri); + if (NS_FAILED(rv)) return rv; + + uri.Insert(NS_LITERAL_CSTRING("jar:"), 0); + uri.AppendLiteral("!/"); + uri.Append(entry); + + nsCStringKey key(uri); + nsJAR* zip = static_cast(static_cast(mZips.Get(&key))); // AddRefs + if (zip) { +#ifdef ZIP_CACHE_HIT_RATE + mZipCacheHits++; +#endif + zip->ClearReleaseTime(); + } + else { + zip = new nsJAR(); + if (zip == nsnull) + return NS_ERROR_OUT_OF_MEMORY; + NS_ADDREF(zip); + zip->SetZipReaderCache(this); + + rv = zip->OpenInner(outerZipReader, entry); + if (NS_FAILED(rv)) { + NS_RELEASE(zip); + return rv; + } + + PRBool collision = mZips.Put(&key, static_cast(zip)); // AddRefs to 2 + NS_ASSERTION(!collision, "horked"); + } + *result = zip; + return rv; +} + static PRBool FindOldestZip(nsHashKey *aKey, void *aData, void* closure) { @@ -1181,12 +1258,22 @@ nsZipReaderCache::ReleaseZip(nsJAR* zip) oldest->SetZipReaderCache(nsnull); // remove from hashtable - nsCAutoString path; - rv = oldest->GetJarPath(path); - if (NS_FAILED(rv)) return rv; + nsCAutoString uri; + rv = oldest->GetJarPath(uri); + if (NS_FAILED(rv)) + return rv; - nsCStringKey key(path); - PRBool removed = mZips.Remove(&key); // Releases + if (zip->mOuterZipEntry.IsEmpty()) { + uri.Insert(NS_LITERAL_CSTRING("file:"), 0); + } else { + uri.Insert(NS_LITERAL_CSTRING("jar:"), 0); + uri.AppendLiteral("!/"); + uri.Append(zip->mOuterZipEntry); + } + + nsCStringKey key(uri); + PRBool removed; + removed = mZips.Remove(&key); // Releases NS_ASSERTION(removed, "botched"); return NS_OK; diff --git a/modules/libjar/nsJAR.h b/modules/libjar/nsJAR.h index 38fb589cb1ec..31fe580f80f2 100644 --- a/modules/libjar/nsJAR.h +++ b/modules/libjar/nsJAR.h @@ -93,6 +93,8 @@ class nsJAR : public nsIZipReader { // Allows nsJARInputStream to call the verification functions friend class nsJARInputStream; + // Allows nsZipReaderCache to access mOuterZipEntry + friend class nsZipReaderCache; public: @@ -130,6 +132,7 @@ class nsJAR : public nsIZipReader protected: //-- Private data members nsCOMPtr mZipFile; // The zip/jar file on disk + nsCString mOuterZipEntry; // The entry in the zip this zip is reading from nsZipArchive mZip; // The underlying zip archive nsObjectHashtable mManifestData; // Stores metadata for each entry PRBool mParsedManifest; // True if manifest has been parsed diff --git a/modules/libjar/nsJARChannel.cpp b/modules/libjar/nsJARChannel.cpp index 417f0c245adf..ae57fd6d5fe6 100644 --- a/modules/libjar/nsJARChannel.cpp +++ b/modules/libjar/nsJARChannel.cpp @@ -84,17 +84,15 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIINPUTSTREAM - nsJARInputThunk(nsIFile *jarFile, + nsJARInputThunk(nsIZipReader *zipReader, nsIURI* fullJarURI, const nsACString &jarEntry, nsIZipReaderCache *jarCache) : mJarCache(jarCache) - , mJarFile(jarFile) + , mJarReader(zipReader) , mJarEntry(jarEntry) , mContentLength(-1) { - NS_ASSERTION(mJarFile, "no jar file"); - if (fullJarURI) { nsresult rv = fullJarURI->GetAsciiSpec(mJarDirSpec); NS_ASSERTION(NS_SUCCEEDED(rv), "this shouldn't fail"); @@ -123,7 +121,6 @@ private: nsCOMPtr mJarCache; nsCOMPtr mJarReader; - nsCOMPtr mJarFile; nsCString mJarDirSpec; nsCOMPtr mJarStream; nsCString mJarEntry; @@ -139,17 +136,6 @@ nsJARInputThunk::EnsureJarStream() return NS_OK; nsresult rv; - if (mJarCache) - rv = mJarCache->GetZip(mJarFile, getter_AddRefs(mJarReader)); - else { - // create an uncached jar reader - mJarReader = do_CreateInstance(kZipReaderCID, &rv); - if (NS_FAILED(rv)) return rv; - - rv = mJarReader->Open(mJarFile); - } - if (NS_FAILED(rv)) return rv; - if (ENTRY_IS_DIRECTORY(mJarEntry)) { // A directory stream also needs the Spec of the FullJarURI // because is included in the stream data itself. @@ -303,9 +289,40 @@ nsJARChannel::CreateJarInput(nsIZipReaderCache *jarCache) // necessarily MT-safe nsCOMPtr clonedFile; nsresult rv = mJarFile->Clone(getter_AddRefs(clonedFile)); - if (NS_FAILED(rv)) return rv; + if (NS_FAILED(rv)) + return rv; - mJarInput = new nsJARInputThunk(clonedFile, mJarURI, mJarEntry, jarCache); + nsCOMPtr reader; + if (jarCache) { + if (mInnerJarEntry.IsEmpty()) + rv = jarCache->GetZip(mJarFile, getter_AddRefs(reader)); + else + rv = jarCache->GetInnerZip(mJarFile, mInnerJarEntry.get(), + getter_AddRefs(reader)); + } else { + // create an uncached jar reader + nsCOMPtr outerReader = do_CreateInstance(kZipReaderCID, &rv); + if (NS_FAILED(rv)) + return rv; + + rv = outerReader->Open(mJarFile); + if (NS_FAILED(rv)) + return rv; + + if (mInnerJarEntry.IsEmpty()) + reader = outerReader; + else { + reader = do_CreateInstance(kZipReaderCID, &rv); + if (NS_FAILED(rv)) + return rv; + + rv = reader->OpenInner(outerReader, mInnerJarEntry.get()); + } + } + if (NS_FAILED(rv)) + return rv; + + mJarInput = new nsJARInputThunk(reader, mJarURI, mJarEntry, jarCache); if (!mJarInput) return NS_ERROR_OUT_OF_MEMORY; NS_ADDREF(mJarInput); @@ -338,6 +355,21 @@ nsJARChannel::EnsureJarInput(PRBool blocking) if (fileURL) fileURL->GetFile(getter_AddRefs(mJarFile)); } + // try to handle a nested jar + if (!mJarFile) { + nsCOMPtr jarURI = do_QueryInterface(mJarBaseURI); + if (jarURI) { + nsCOMPtr fileURL; + nsCOMPtr innerJarURI; + rv = jarURI->GetJARFile(getter_AddRefs(innerJarURI)); + if (NS_SUCCEEDED(rv)) + fileURL = do_QueryInterface(innerJarURI); + if (fileURL) { + fileURL->GetFile(getter_AddRefs(mJarFile)); + jarURI->GetJAREntry(mInnerJarEntry); + } + } + } if (mJarFile) { mIsUnsafe = PR_FALSE; diff --git a/modules/libjar/nsJARChannel.h b/modules/libjar/nsJARChannel.h index 9e84f58e9c79..404b077e050a 100644 --- a/modules/libjar/nsJARChannel.h +++ b/modules/libjar/nsJARChannel.h @@ -108,6 +108,7 @@ private: nsCOMPtr mJarFile; nsCOMPtr mJarBaseURI; nsCString mJarEntry; + nsCString mInnerJarEntry; }; #endif // nsJARChannel_h__ From 4fa3cafba31fd05973d1088bb861763012b47a91 Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Wed, 8 Sep 2010 20:39:00 -0700 Subject: [PATCH 007/176] Bug 533038 - 5. Support loading jar uris in the js subscript loader, r=bsmedberg a=blocking-beta6 --- js/src/xpconnect/loader/mozJSSubScriptLoader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/src/xpconnect/loader/mozJSSubScriptLoader.cpp b/js/src/xpconnect/loader/mozJSSubScriptLoader.cpp index 0f12b0f81eb2..7c3f145bfed7 100644 --- a/js/src/xpconnect/loader/mozJSSubScriptLoader.cpp +++ b/js/src/xpconnect/loader/mozJSSubScriptLoader.cpp @@ -281,7 +281,8 @@ mozJSSubScriptLoader::LoadSubScript (const PRUnichar * aURL if (!scheme.EqualsLiteral("chrome")) { // This might be a URI to a local file, though! - nsCOMPtr fileURL = do_QueryInterface(uri); + nsCOMPtr innerURI = NS_GetInnermostURI(uri); + nsCOMPtr fileURL = do_QueryInterface(innerURI); if (!fileURL) { errmsg = JS_NewStringCopyZ (cx, LOAD_ERROR_URI_NOT_LOCAL); From 44231747f69cf3ce82407580d5b76bd13bbeaa70 Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Wed, 8 Sep 2010 20:39:19 -0700 Subject: [PATCH 008/176] Bug 533038 - 6. Add flush-cache-entry to flush specific jars from the cache, r=taras a=blocking-beta6 --- modules/libjar/nsJAR.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/modules/libjar/nsJAR.cpp b/modules/libjar/nsJAR.cpp index a9cdc0cd37f7..851fc0ee436f 100644 --- a/modules/libjar/nsJAR.cpp +++ b/modules/libjar/nsJAR.cpp @@ -1050,6 +1050,7 @@ nsZipReaderCache::Init(PRUint32 cacheSize) { os->AddObserver(this, "memory-pressure", PR_TRUE); os->AddObserver(this, "chrome-flush-caches", PR_TRUE); + os->AddObserver(this, "flush-cache-entry", PR_TRUE); } // ignore failure of the observer registration. @@ -1317,6 +1318,32 @@ nsZipReaderCache::Observe(nsISupports *aSubject, mZips.Enumerate(DropZipReaderCache, nsnull); mZips.Reset(); } + else if (strcmp(aTopic, "flush-cache-entry") == 0) { + nsCOMPtr file = do_QueryInterface(aSubject); + if (!file) + return NS_OK; + + nsCAutoString uri; + if (NS_FAILED(file->GetNativePath(uri))) + return NS_OK; + + uri.Insert(NS_LITERAL_CSTRING("file:"), 0); + nsCStringKey key(uri); + + nsAutoLock lock(mLock); + nsJAR* zip = static_cast(static_cast(mZips.Get(&key))); + if (!zip) + return NS_OK; + +#ifdef ZIP_CACHE_HIT_RATE + mZipCacheFlushes++; +#endif + + zip->SetZipReaderCache(nsnull); + + mZips.Remove(&key); + NS_RELEASE(zip); + } return NS_OK; } From 2833d5d00ada12c7949756722f1078220de33bc8 Mon Sep 17 00:00:00 2001 From: Bruno 'Aqualon' Escherl Date: Wed, 8 Sep 2010 20:14:06 +0200 Subject: [PATCH 009/176] Bug 594342 - add SeaMonkey to compatible applications list for search results, r=Mossop a=test-only --- .../test/browser/browser_bug591465.xml | 6 ++++ .../test/browser/browser_searching.xml | 36 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/toolkit/mozapps/extensions/test/browser/browser_bug591465.xml b/toolkit/mozapps/extensions/test/browser/browser_bug591465.xml index 042bec5666c2..9c2e102e72c7 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_bug591465.xml +++ b/toolkit/mozapps/extensions/test/browser/browser_bug591465.xml @@ -21,6 +21,12 @@ 0 * + + SeaMonkey + {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} + 0 + * + ALL http://example.com/browser/toolkit/mozapps/extensions/test/browser/addons/browser_searching.xpi diff --git a/toolkit/mozapps/extensions/test/browser/browser_searching.xml b/toolkit/mozapps/extensions/test/browser/browser_searching.xml index 55b049621d74..198013b5b3ee 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_searching.xml +++ b/toolkit/mozapps/extensions/test/browser/browser_searching.xml @@ -21,6 +21,12 @@ 0 * + + SeaMonkey + {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} + 0 + * + ALL http://example.com/addon1.xpi @@ -46,6 +52,12 @@ 0 * + + SeaMonkey + {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} + 0 + * + ALL http://example.com/install1.xpi @@ -71,6 +83,12 @@ 0 * + + SeaMonkey + {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} + 0 + * + ALL http://example.com/browser/toolkit/mozapps/extensions/test/browser/addons/browser_searching.xpi @@ -96,6 +114,12 @@ 0 * + + SeaMonkey + {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} + 0 + * + ALL http://example.com/remote2.xpi @@ -121,6 +145,12 @@ 0 * + + SeaMonkey + {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} + 0 + * + ALL http://example.com/remote3.xpi @@ -146,6 +176,12 @@ 0 * + + SeaMonkey + {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} + 0 + * + ALL http://example.com/remote4.xpi From b0c0705ee93893d1f5cfbfddcf42d6b4b6e82e52 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 9 Sep 2010 01:38:04 -0400 Subject: [PATCH 010/176] 588174. Make it possible to pass an explicit callback function to mozRequestAnimationFrame. r=roc, sr=dbaron --- content/base/public/nsIDocument.h | 12 +++- content/base/src/nsDocument.cpp | 37 +++++++++++- dom/base/nsGlobalWindow.cpp | 7 ++- dom/interfaces/base/Makefile.in | 1 + .../base/nsIAnimationFrameListener.idl | 53 ++++++++++++++++ dom/interfaces/base/nsIDOMWindowInternal.idl | 6 +- layout/base/nsRefreshDriver.cpp | 34 ++++++++++- layout/base/nsRefreshDriver.h | 12 ++++ layout/base/tests/Makefile.in | 1 + layout/base/tests/test_bug588174.html | 60 +++++++++++++++++++ 10 files changed, 213 insertions(+), 10 deletions(-) create mode 100644 dom/interfaces/base/nsIAnimationFrameListener.idl create mode 100644 layout/base/tests/test_bug588174.html diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 707f2cab33c2..bd9364059bfd 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -64,6 +64,7 @@ #endif // MOZ_SMIL #include "nsIScriptGlobalObject.h" #include "nsIDocumentEncoder.h" +#include "nsIAnimationFrameListener.h" class nsIContent; class nsPresContext; @@ -1448,12 +1449,19 @@ public: */ virtual Element* LookupImageElement(const nsAString& aElementId) = 0; - void ScheduleBeforePaintEvent(); + void ScheduleBeforePaintEvent(nsIAnimationFrameListener* aListener); void BeforePaintEventFiring() { mHavePendingPaint = PR_FALSE; } + typedef nsTArray< nsCOMPtr > AnimationListenerList; + /** + * Put this documents animation frame listeners into the provided + * list, and forget about them. + */ + void TakeAnimationFrameListeners(AnimationListenerList& aListeners); + // This returns true when the document tree is being teared down. PRBool InUnlinkOrDeletion() { return mInUnlinkOrDeletion; } @@ -1689,6 +1697,8 @@ protected: nsPIDOMWindow *mWindow; nsCOMPtr mCachedEncoder; + + AnimationListenerList mAnimationFrameListeners; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocument, NS_IDOCUMENT_IID) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index e50b14a24139..fa9b27a80a58 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -1835,6 +1835,11 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDocument) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mCatalogSheets) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mPreloadingImages) + for (PRUint32 i = 0; i < tmp->mAnimationFrameListeners.Length(); ++i) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mAnimationFrameListeners[i]"); + cb.NoteXPCOMChild(tmp->mAnimationFrameListeners[i]); + } + #ifdef MOZ_SMIL // Traverse animation components if (tmp->mAnimationController) { @@ -3214,9 +3219,12 @@ nsDocument::doCreateShell(nsPresContext* aContext, mExternalResourceMap.ShowViewers(); + nsRefreshDriver* rd = mPresShell->GetPresContext()->RefreshDriver(); if (mHavePendingPaint) { - mPresShell->GetPresContext()->RefreshDriver()-> - ScheduleBeforePaintEvent(this); + rd->ScheduleBeforePaintEvent(this); + } + if (!mAnimationFrameListeners.IsEmpty()) { + rd->ScheduleAnimationFrameListeners(this); } shell.swap(*aInstancePtrResult); @@ -3224,6 +3232,13 @@ nsDocument::doCreateShell(nsPresContext* aContext, return NS_OK; } +void +nsIDocument::TakeAnimationFrameListeners(AnimationListenerList& aListeners) +{ + aListeners.AppendElements(mAnimationFrameListeners); + mAnimationFrameListeners.Clear(); +} + void nsDocument::DeleteShell() { @@ -3231,6 +3246,10 @@ nsDocument::DeleteShell() if (mHavePendingPaint) { mPresShell->GetPresContext()->RefreshDriver()->RevokeBeforePaintEvent(this); } + if (!mAnimationFrameListeners.IsEmpty()) { + mPresShell->GetPresContext()->RefreshDriver()-> + RevokeAnimationFrameListeners(this); + } mPresShell = nsnull; } @@ -8071,8 +8090,19 @@ nsIDocument::CreateStaticClone(nsISupports* aCloneContainer) } void -nsIDocument::ScheduleBeforePaintEvent() +nsIDocument::ScheduleBeforePaintEvent(nsIAnimationFrameListener* aListener) { + if (aListener) { + PRBool alreadyRegistered = !mAnimationFrameListeners.IsEmpty(); + if (mAnimationFrameListeners.AppendElement(aListener) && + !alreadyRegistered && mPresShell) { + mPresShell->GetPresContext()->RefreshDriver()-> + ScheduleAnimationFrameListeners(this); + } + + return; + } + if (!mHavePendingPaint) { // We don't want to use GetShell() here, because we want to schedule the // paint even if we're frozen. Either we'll get unfrozen and then the @@ -8082,6 +8112,7 @@ nsIDocument::ScheduleBeforePaintEvent() mPresShell->GetPresContext()->RefreshDriver()-> ScheduleBeforePaintEvent(this); } + } nsresult diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index d687ed70689a..6c6f70ae772f 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -3523,15 +3523,16 @@ nsGlobalWindow::GetMozPaintCount(PRUint64* aResult) } NS_IMETHODIMP -nsGlobalWindow::MozRequestAnimationFrame() +nsGlobalWindow::MozRequestAnimationFrame(nsIAnimationFrameListener* aListener) { - FORWARD_TO_INNER(MozRequestAnimationFrame, (), NS_ERROR_NOT_INITIALIZED); + FORWARD_TO_INNER(MozRequestAnimationFrame, (aListener), + NS_ERROR_NOT_INITIALIZED); if (!mDoc) { return NS_OK; } - mDoc->ScheduleBeforePaintEvent(); + mDoc->ScheduleBeforePaintEvent(aListener); return NS_OK; } diff --git a/dom/interfaces/base/Makefile.in b/dom/interfaces/base/Makefile.in index 32af58f6f105..e73d935f1a52 100644 --- a/dom/interfaces/base/Makefile.in +++ b/dom/interfaces/base/Makefile.in @@ -56,6 +56,7 @@ SDK_XPIDLSRCS = \ $(NULL) XPIDLSRCS = \ + nsIAnimationFrameListener.idl \ nsIBrowserDOMWindow.idl \ nsIContentPrefService.idl \ nsIContentURIGrouper.idl \ diff --git a/dom/interfaces/base/nsIAnimationFrameListener.idl b/dom/interfaces/base/nsIAnimationFrameListener.idl new file mode 100644 index 000000000000..a4a2e701e064 --- /dev/null +++ b/dom/interfaces/base/nsIAnimationFrameListener.idl @@ -0,0 +1,53 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla.org code. + * + * The Initial Developer of the Original Code is the Mozilla Foundation. + * + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Boris Zbarsky (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/** + * Interface that represents a listener to be passed to + * mozRequestAnimationFrame + */ + +#include "domstubs.idl" + +[scriptable, function, uuid(ba240e38-c15a-4fb2-802a-8a48f09331bd)] +interface nsIAnimationFrameListener : nsISupports +{ + /** + * The timestamp is the same as it would be for the a corresponding + * MozBeforePaint event. + */ + void onBeforePaint(in DOMTimeStamp timeStamp); +}; diff --git a/dom/interfaces/base/nsIDOMWindowInternal.idl b/dom/interfaces/base/nsIDOMWindowInternal.idl index 732bed99bdb4..fa3337d1192e 100644 --- a/dom/interfaces/base/nsIDOMWindowInternal.idl +++ b/dom/interfaces/base/nsIDOMWindowInternal.idl @@ -43,8 +43,9 @@ interface nsIPrompt; interface nsIControllers; interface nsIDOMLocation; interface nsIVariant; +interface nsIAnimationFrameListener; -[scriptable, uuid(de12997f-9f66-4241-b092-d0ed365ad72e)] +[scriptable, uuid(9d6a1157-0719-46a7-b49f-7ffeaa0b5c86)] interface nsIDOMWindowInternal : nsIDOMWindow2 { readonly attribute nsIDOMWindowInternal window; @@ -224,7 +225,8 @@ interface nsIDOMWindowInternal : nsIDOMWindow2 /** * Request a refresh of this browser window. */ - void mozRequestAnimationFrame(); + void + mozRequestAnimationFrame([optional] in nsIAnimationFrameListener aListener); /** * The current animation start time in milliseconds since the epoch. diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index 194a1cf21f17..652ffbe3416a 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -182,6 +182,7 @@ nsRefreshDriver::ObserverCount() const sum += mStyleFlushObservers.Length(); sum += mLayoutFlushObservers.Length(); sum += mBeforePaintTargets.Length(); + sum += mAnimationFrameListenerDocs.Length(); return sum; } @@ -263,16 +264,31 @@ nsRefreshDriver::Notify(nsITimer * /* unused */) // target as needed. nsTArray targets; targets.SwapElements(mBeforePaintTargets); - PRInt64 eventTime = mMostRecentRefreshEpochTime / PR_USEC_PER_MSEC; for (PRUint32 i = 0; i < targets.Length(); ++i) { targets[i]->BeforePaintEventFiring(); } + + // Also grab all of our animation frame listeners up front. + nsIDocument::AnimationListenerList animationListeners; + for (PRUint32 i = 0; i < mAnimationFrameListenerDocs.Length(); ++i) { + mAnimationFrameListenerDocs[i]-> + TakeAnimationFrameListeners(animationListeners); + } + // OK, now reset mAnimationFrameListenerDocs so they can be + // readded as needed. + mAnimationFrameListenerDocs.Clear(); + + PRInt64 eventTime = mMostRecentRefreshEpochTime / PR_USEC_PER_MSEC; for (PRUint32 i = 0; i < targets.Length(); ++i) { nsEvent ev(PR_TRUE, NS_BEFOREPAINT); ev.time = eventTime; nsEventDispatcher::Dispatch(targets[i], nsnull, &ev); } + for (PRUint32 i = 0; i < animationListeners.Length(); ++i) { + animationListeners[i]->OnBeforePaint(eventTime); + } + // This is the Flush_Style case. while (!mStyleFlushObservers.IsEmpty() && mPresContext && mPresContext->GetPresShell()) { @@ -362,8 +378,24 @@ nsRefreshDriver::ScheduleBeforePaintEvent(nsIDocument* aDocument) return appended; } +void +nsRefreshDriver::ScheduleAnimationFrameListeners(nsIDocument* aDocument) +{ + NS_ASSERTION(mAnimationFrameListenerDocs.IndexOf(aDocument) == + mAnimationFrameListenerDocs.NoIndex, + "Don't schedule the same document multiple times"); + mAnimationFrameListenerDocs.AppendElement(aDocument); + EnsureTimerStarted(); +} + void nsRefreshDriver::RevokeBeforePaintEvent(nsIDocument* aDocument) { mBeforePaintTargets.RemoveElement(aDocument); } + +void +nsRefreshDriver::RevokeAnimationFrameListeners(nsIDocument* aDocument) +{ + mAnimationFrameListenerDocs.RemoveElement(aDocument); +} diff --git a/layout/base/nsRefreshDriver.h b/layout/base/nsRefreshDriver.h index be43a4e6aad2..3369c90c122b 100644 --- a/layout/base/nsRefreshDriver.h +++ b/layout/base/nsRefreshDriver.h @@ -151,11 +151,21 @@ public: */ PRBool ScheduleBeforePaintEvent(nsIDocument* aDocument); + /** + * Add a document for which we have nsIAnimationFrameListeners + */ + void ScheduleAnimationFrameListeners(nsIDocument* aDocument); + /** * Remove a document for which we should fire a MozBeforePaint event. */ void RevokeBeforePaintEvent(nsIDocument* aDocument); + /** + * Remove a document for which we have nsIAnimationFrameListeners + */ + void RevokeAnimationFrameListeners(nsIDocument* aDocument); + /** * Tell the refresh driver that it is done driving refreshes and * should stop its timer and forget about its pres context. This may @@ -225,6 +235,8 @@ private: nsAutoTArray mLayoutFlushObservers; // nsTArray on purpose, because we want to be able to swap. nsTArray mBeforePaintTargets; + // nsTArray on purpose, because we want to be able to swap. + nsTArray mAnimationFrameListenerDocs; }; #endif /* !defined(nsRefreshDriver_h_) */ diff --git a/layout/base/tests/Makefile.in b/layout/base/tests/Makefile.in index ff72f1e331fd..821204a6fe16 100644 --- a/layout/base/tests/Makefile.in +++ b/layout/base/tests/Makefile.in @@ -280,6 +280,7 @@ _TEST_FILES += \ test_bug570378-persian-5g.html \ bug570378-persian-5.html \ bug570378-persian-5-ref.html \ + test_bug588174.html \ $(NULL) endif diff --git a/layout/base/tests/test_bug588174.html b/layout/base/tests/test_bug588174.html new file mode 100644 index 000000000000..3194fdd4d72b --- /dev/null +++ b/layout/base/tests/test_bug588174.html @@ -0,0 +1,60 @@ + + + + + Test for Bug 569520 + + + + + +Mozilla Bug 569520 +

+ +
+
+
+ + From 31576fc1320f68175ed4df90b973233da438e653 Mon Sep 17 00:00:00 2001 From: Julian Reschke Date: Thu, 9 Sep 2010 01:38:10 -0400 Subject: [PATCH 011/176] Bug 560838. Spell 'Content-Type' correctly. r=bzbarsky, a=jst --- content/base/src/mozSanitizingSerializer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/base/src/mozSanitizingSerializer.cpp b/content/base/src/mozSanitizingSerializer.cpp index 8decb9848f20..3f10d55dd951 100644 --- a/content/base/src/mozSanitizingSerializer.cpp +++ b/content/base/src/mozSanitizingSerializer.cpp @@ -329,7 +329,7 @@ NS_IMETHODIMP mozSanitizingHTMLSerializer::SetDocumentCharset(nsACString& aCharset) { // No idea, if this works - it isn't invoked by |TestOutput|. - Write(NS_LITERAL_STRING("\n Date: Thu, 9 Sep 2010 01:38:10 -0400 Subject: [PATCH 012/176] Bug 593689. Convert arguments to new Image() to integers the way other conversions to integer happen. r=jst a=jst --- .../html/content/src/nsHTMLImageElement.cpp | 8 +-- content/html/content/test/Makefile.in | 1 + content/html/content/test/test_bug593689.html | 51 +++++++++++++++++++ 3 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 content/html/content/test/test_bug593689.html diff --git a/content/html/content/src/nsHTMLImageElement.cpp b/content/html/content/src/nsHTMLImageElement.cpp index 3fc006edabe8..5f653ba1d90d 100644 --- a/content/html/content/src/nsHTMLImageElement.cpp +++ b/content/html/content/src/nsHTMLImageElement.cpp @@ -601,16 +601,16 @@ nsHTMLImageElement::Initialize(nsISupports* aOwner, JSContext* aContext, } // The first (optional) argument is the width of the image - int32 width; - JSBool ret = JS_ValueToInt32(aContext, argv[0], &width); + uint32 width; + JSBool ret = JS_ValueToECMAUint32(aContext, argv[0], &width); NS_ENSURE_TRUE(ret, NS_ERROR_INVALID_ARG); nsresult rv = SetIntAttr(nsGkAtoms::width, static_cast(width)); if (NS_SUCCEEDED(rv) && (argc > 1)) { // The second (optional) argument is the height of the image - int32 height; - ret = JS_ValueToInt32(aContext, argv[1], &height); + uint32 height; + ret = JS_ValueToECMAUint32(aContext, argv[1], &height); NS_ENSURE_TRUE(ret, NS_ERROR_INVALID_ARG); rv = SetIntAttr(nsGkAtoms::height, static_cast(height)); diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index f63f52780a35..191d10a550f2 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -211,6 +211,7 @@ _TEST_FILES = \ test_bug588683-4.html \ test_bug590353-1.html \ test_bug590353-2.html \ + test_bug593689.html \ $(NULL) libs:: $(_TEST_FILES) diff --git a/content/html/content/test/test_bug593689.html b/content/html/content/test/test_bug593689.html new file mode 100644 index 000000000000..4cdf2544c35b --- /dev/null +++ b/content/html/content/test/test_bug593689.html @@ -0,0 +1,51 @@ + + + + + Test for Bug 593689 + + + + + +Mozilla Bug 593689 +

+ +
+
+
+ + From 4a4cdce2c36700bc1259efa281cffc75f9b6b0d6 Mon Sep 17 00:00:00 2001 From: Sid Stamm Date: Thu, 9 Sep 2010 01:38:10 -0400 Subject: [PATCH 013/176] Bug 592197 - SSL pages don't work when using a NTLM proxy. r=bzbarsky, a=blocker --- netwerk/protocol/http/nsHttpChannel.cpp | 40 +++++++++++++++++-------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 8d599983224d..071df5e99940 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -209,9 +209,13 @@ nsHttpChannel::Connect(PRBool firstTime) PRBool isStsHost = PR_FALSE; rv = stss->IsStsURI(mURI, &isStsHost); - NS_ENSURE_SUCCESS(rv, rv); - if (isStsHost) { + // if STS fails, there's no reason to cancel the load, but it's + // worrisome. + NS_ASSERTION(NS_SUCCEEDED(rv), + "Something is wrong with STS: IsStsURI failed."); + + if (NS_SUCCEEDED(rv) && isStsHost) { LOG(("nsHttpChannel::Connect() STS permissions found\n")); return AsyncCall(&nsHttpChannel::HandleAsyncRedirectChannelToHttps); } @@ -944,7 +948,7 @@ nsHttpChannel::ProcessSTSHeader() nsCAutoString asciiHost; rv = mURI->GetAsciiHost(asciiHost); - NS_ENSURE_SUCCESS(rv, rv); + NS_ENSURE_SUCCESS(rv, NS_OK); // If the channel is not a hostname, but rather an IP, STS doesn't do // anything. @@ -955,13 +959,17 @@ nsHttpChannel::ProcessSTSHeader() nsIStrictTransportSecurityService* stss = gHttpHandler->GetSTSService(); NS_ENSURE_TRUE(stss, NS_ERROR_OUT_OF_MEMORY); + // mSecurityInfo may not always be present, and if it's not then it is okay + // to just disregard any STS headers since we know nothing about the + // security of the connection. + NS_ENSURE_TRUE(mSecurityInfo, NS_OK); + // Check the trustworthiness of the channel (are there any cert errors?) // If there are certificate errors, we still load the data, we just ignore // any STS headers that are present. - NS_ENSURE_TRUE(mSecurityInfo, NS_ERROR_FAILURE); PRBool tlsIsBroken = PR_FALSE; rv = stss->ShouldIgnoreStsHeader(mSecurityInfo, &tlsIsBroken); - NS_ENSURE_SUCCESS(rv, rv); + NS_ENSURE_SUCCESS(rv, NS_OK); // If this was already an STS host, the connection should have been aborted // by the bad cert handler in the case of cert errors. If it didn't abort the connection, @@ -970,7 +978,9 @@ nsHttpChannel::ProcessSTSHeader() // will happen during the session. PRBool wasAlreadySTSHost; rv = stss->IsStsURI(mURI, &wasAlreadySTSHost); - NS_ENSURE_SUCCESS(rv, rv); + // Failure here means STS is broken. Don't prevent the load, but this + // shouldn't fail. + NS_ENSURE_SUCCESS(rv, NS_OK); NS_ASSERTION(!(wasAlreadySTSHost && tlsIsBroken), "connection should have been aborted by nss-bad-cert-handler"); @@ -992,6 +1002,7 @@ nsHttpChannel::ProcessSTSHeader() LOG(("STS: No STS header, continuing load.\n")); return NS_OK; } + // All other failures are fatal. NS_ENSURE_SUCCESS(rv, rv); rv = stss->ProcessStsHeader(mURI, stsHeader.get()); @@ -1012,13 +1023,16 @@ nsHttpChannel::ProcessResponse() LOG(("nsHttpChannel::ProcessResponse [this=%p httpStatus=%u]\n", this, httpStatus)); - if (mTransaction->SSLConnectFailed() && - !ShouldSSLProxyResponseContinue(httpStatus)) - return ProcessFailedSSLConnect(httpStatus); - - // If STS data is present, process it here. - rv = ProcessSTSHeader(); - NS_ENSURE_SUCCESS(rv, rv); + if (mTransaction->SSLConnectFailed()) { + if (!ShouldSSLProxyResponseContinue(httpStatus)) + return ProcessFailedSSLConnect(httpStatus); + // If SSL proxy response needs to complete, wait to process connection + // for Strict-Transport-Security. + } else { + // Given a successful connection, process any STS data that's relevant. + rv = ProcessSTSHeader(); + NS_ASSERTION(NS_SUCCEEDED(rv), "ProcessSTSHeader failed, continuing load."); + } // notify "http-on-examine-response" observers gHttpHandler->OnExamineResponse(this); From d77d33814274e00a6253c6cd2ba46ff3c886c448 Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Wed, 21 Jul 2010 12:49:36 +0300 Subject: [PATCH 014/176] Bug 577508 - Make the HTML5 parser hide the old page from view when the page being loaded shows a dialog. r=bzbarsky, a=blocking2.0-final. --- layout/base/tests/test_bug469170.html | 42 +++++++++++++++------------ parser/html/nsHtml5TreeOpExecutor.cpp | 4 +++ 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/layout/base/tests/test_bug469170.html b/layout/base/tests/test_bug469170.html index fc1aad2ba74b..a57480f4e2e8 100644 --- a/layout/base/tests/test_bug469170.html +++ b/layout/base/tests/test_bug469170.html @@ -9,7 +9,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=469170 - +

Mozilla Bug 469170

+ +

InstallTrigger tests

+

+

+ + From c8cf79903e9a552c5bb1f9bdbd75c8f9c487661c Mon Sep 17 00:00:00 2001 From: "KUROSAWA, Takeshi" Date: Thu, 9 Sep 2010 16:27:10 -0400 Subject: [PATCH 020/176] Bug 422179 - Implement bilinear filtering of upscaled images for Linux; r=jmuizelaar a=blocking-final+ --- gfx/thebes/gfxDrawable.cpp | 40 +++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/gfx/thebes/gfxDrawable.cpp b/gfx/thebes/gfxDrawable.cpp index ba64f563d8e2..cb6d4f30e4e6 100644 --- a/gfx/thebes/gfxDrawable.cpp +++ b/gfx/thebes/gfxDrawable.cpp @@ -38,6 +38,10 @@ #include "gfxASurface.h" #include "gfxContext.h" #include "gfxPlatform.h" +#ifdef MOZ_X11 +#include "cairo.h" +#include "gfxXlibSurface.h" +#endif gfxSurfaceDrawable::gfxSurfaceDrawable(gfxASurface* aSurface, const gfxIntSize aSize, @@ -61,10 +65,11 @@ DeviceToImageTransform(gfxContext* aContext, return gfxMatrix(deviceToUser).Multiply(aUserSpaceToImageSpace); } -static void +static void PreparePatternForUntiledDrawing(gfxPattern* aPattern, const gfxMatrix& aDeviceToImage, gfxASurface::gfxSurfaceType aSurfaceType, + nsRefPtr currentTarget, const gfxPattern::GraphicsFilter aDefaultFilter) { // In theory we can handle this using cairo's EXTEND_PAD, @@ -85,11 +90,40 @@ PreparePatternForUntiledDrawing(gfxPattern* aPattern, // But don't do this for simple downscales because it's horrible. // Downscaling means that device-space coordinates are // scaled *up* to find the image pixel coordinates. + // + // Update 8/11/09: The underlying X server/driver bugs are now + // fixed, and cairo uses the fast XRender code-path as of 1.9.2 + // (commit a1d0a06b6275cac3974be84919993e187394fe43) -- + // but only if running on a 1.7 X server. + // So we enable EXTEND_PAD provided that we're running a recent + // enough cairo version (obviously, this is only relevant if + // --enable-system-cairo is used) AND running on a recent + // enough X server. This should finally bring linux up to par + // with other systems. + PRBool isDownscale = aDeviceToImage.xx >= 1.0 && aDeviceToImage.yy >= 1.0 && aDeviceToImage.xy == 0.0 && aDeviceToImage.yx == 0.0; if (!isDownscale) { - aPattern->SetFilter(gfxPattern::FILTER_FAST); +#ifdef MOZ_X11 + PRBool fastExtendPad = PR_FALSE; + if (currentTarget->GetType() == gfxASurface::SurfaceTypeXlib && + cairo_version() >= CAIRO_VERSION_ENCODE(1,9,2)) { + gfxXlibSurface *xlibSurface = + static_cast(currentTarget.get()); + Display *dpy = xlibSurface->XDisplay(); + // This is the exact condition for cairo to use XRender for + // EXTEND_PAD + if (VendorRelease (dpy) < 60700000 && + VendorRelease (dpy) >= 10699000) + fastExtendPad = PR_TRUE; + } + if (fastExtendPad) { + aPattern->SetExtend(gfxPattern::EXTEND_PAD); + aPattern->SetFilter(aDefaultFilter); + } else +#endif + aPattern->SetFilter(gfxPattern::FILTER_FAST); } break; } @@ -127,7 +161,7 @@ gfxSurfaceDrawable::Draw(gfxContext* aContext, gfxMatrix deviceSpaceToImageSpace = DeviceToImageTransform(aContext, aTransform); PreparePatternForUntiledDrawing(pattern, deviceSpaceToImageSpace, - surfaceType, aFilter); + surfaceType, currentTarget, aFilter); } #ifdef MOZ_GFX_OPTIMIZE_MOBILE pattern->SetFilter(gfxPattern::FILTER_FAST); From 3d34b911185d3b9febd81f2814b8ef129f340af2 Mon Sep 17 00:00:00 2001 From: "KUROSAWA, Takeshi" Date: Thu, 9 Sep 2010 16:27:12 -0400 Subject: [PATCH 021/176] Bug 422179 - Part 2: Honor Cairo version in tree; r=jmuizelaar a=blocking-final+ try: --build do --p linux,linux64 --m none --u all --t all --- gfx/cairo/cairo/src/cairo-features.h.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gfx/cairo/cairo/src/cairo-features.h.in b/gfx/cairo/cairo/src/cairo-features.h.in index 22d15c399c5a..19f7f461327e 100644 --- a/gfx/cairo/cairo/src/cairo-features.h.in +++ b/gfx/cairo/cairo/src/cairo-features.h.in @@ -52,8 +52,8 @@ #endif #define CAIRO_VERSION_MAJOR 1 -#define CAIRO_VERSION_MINOR 7 -#define CAIRO_VERSION_MICRO 4 +#define CAIRO_VERSION_MINOR 9 +#define CAIRO_VERSION_MICRO 5 @PS_SURFACE_FEATURE@ From 8338d82d6ef3207d431def91887ed31542b7b90b Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 9 Sep 2010 16:27:17 -0400 Subject: [PATCH 022/176] Bug 422179 - Part 3: Disable a reftest which fails because of bilinear filtering; r=jrmuizelaar a=NPOTB --- layout/reftests/backgrounds/reftest.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/reftests/backgrounds/reftest.list b/layout/reftests/backgrounds/reftest.list index c8a831cf4c65..f60abb5c5e4b 100644 --- a/layout/reftests/backgrounds/reftest.list +++ b/layout/reftests/backgrounds/reftest.list @@ -98,7 +98,7 @@ # the image aren't the issue, because they're being obscured to avoid sampling # algorithm dependencies (at least assuming the sampling algorithm in use # doesn't sample too far astray from the boundaries). -fails-if(!gtk2Widget) == background-size-zoom-repeat.html background-size-zoom-repeat-ref.html +fails == background-size-zoom-repeat.html background-size-zoom-repeat-ref.html # background-size affects images without intrinsic dimensions specially; we may # not support such image formats right now, but when we do, we want From cac2fbc4d8732503384029c8e26c1aea9097ada5 Mon Sep 17 00:00:00 2001 From: Rob Campbell Date: Thu, 9 Sep 2010 18:52:43 -0300 Subject: [PATCH 023/176] Bug 592525 - Txul Regression between 1PM-3PM PDT, r=gavin, a=blocking2.0 --- browser/base/content/browser.xul | 7 +-- browser/base/content/inspector.js | 59 +++++++++++++++---- .../test/browser_inspector_initialization.js | 2 + 3 files changed, 52 insertions(+), 16 deletions(-) diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 612d8d8f78ab..80f5f494e987 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -268,12 +268,7 @@ class="toolbarbutton-text" oncommand="InspectorUI.toggleDOMPanel();"/> - + + From 8ffa58d3c23cb081c512f469e72c10670560f632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Thu, 9 Sep 2010 17:07:10 +0200 Subject: [PATCH 048/176] Backed out bug 587901's winstripe changes. a=backout --- browser/themes/winstripe/browser/browser.css | 36 ++++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/browser/themes/winstripe/browser/browser.css b/browser/themes/winstripe/browser/browser.css index 6a9e3bb18a18..07d884a0c79e 100644 --- a/browser/themes/winstripe/browser/browser.css +++ b/browser/themes/winstripe/browser/browser.css @@ -1005,17 +1005,14 @@ toolbar:not([iconsize="small"])[mode="icons"] #forward-button:not([disabled="tru /* identity box */ #identity-box { - background-color: rgb(95%,95%,95%); - background-image: -moz-linear-gradient(rgba(255,255,255,.5), rgba(70%,70%,70%,.1), rgba(0,0,0,.1)); - background-origin: border-box; - border: 1px solid rgba(0,0,0,.15); + background-color: -moz-dialog; + background-image: -moz-linear-gradient(rgba(255,255,255,.25), rgba(0,0,0,.15)); + color: -moz-dialogText; -moz-border-radius: 2px; - -moz-box-shadow: 0 1px 0 rgba(0,0,0,.1), - 0 0 1px rgba(255,255,255,.4) inset; - min-height: 16px; - font-weight: bold; - color: #666; - text-shadow: 0 1px 0 rgba(255,255,255,.25); +} + +#identity-box:hover { + background-image: -moz-linear-gradient(rgba(255,255,255,.5), rgba(50%,50%,50%,.2), rgba(0,0,0,.15)); } #identity-box[open="true"], @@ -1025,30 +1022,33 @@ toolbar:not([iconsize="small"])[mode="icons"] #forward-button:not([disabled="tru #identity-box.verifiedDomain, #identity-box.verifiedIdentity { - color: #444; - border-color: rgba(0,0,0,.3); + color: white; + text-shadow: 0 1px 0 rgba(0,0,0,.25); + -moz-box-shadow: 0 0 0 1px rgba(0,0,0,.2) inset; } #identity-box.verifiedDomain { - background-color: hsl(219,75%,80%); + background-color: hsl(219,45%,60%); } #identity-box.verifiedIdentity { - background-color: hsl(92,55%,72%); + background-color: hsl(92,45%,52%); } #identity-box:-moz-focusring { - outline: 1px dotted #444; + outline: 1px dotted -moz-DialogText; outline-offset: -3px; } +#identity-box.verifiedDomain:-moz-focusring, +#identity-box.verifiedIdentity:-moz-focusring { + outline-color: white; +} + #identity-icon-labels { -moz-margin-start: 1px; -moz-margin-end: 3px; -moz-transform: translate(0, -1px); - /* compensate #identity-box border: */ - margin-top: -1px; - margin-bottom: -1px; } /* Location bar dropmarker */ From b157c42495f3d1e1fb1cb9f33eb32d4d700ca1b2 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:45 -0700 Subject: [PATCH 049/176] Add support for calc() on -moz-border-radius and -moz-outline-radius. (Bug 585715) r=bzbarsky a2.0=blocking2.0:beta6 --- layout/base/nsLayoutUtils.cpp | 13 +- layout/generic/nsFrame.cpp | 20 ++- .../css-calc/border-radius-1-ref.html | 13 ++ layout/reftests/css-calc/border-radius-1.html | 13 ++ layout/reftests/css-calc/reftest.list | 1 + layout/style/nsCSSParser.cpp | 10 +- layout/style/nsRuleNode.cpp | 6 +- layout/style/nsStyleStruct.h | 4 +- layout/style/test/property_database.js | 114 ++++++++++++++++-- 9 files changed, 157 insertions(+), 37 deletions(-) create mode 100644 layout/reftests/css-calc/border-radius-1-ref.html create mode 100644 layout/reftests/css-calc/border-radius-1.html diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 9bc80d917fce..bffef0ddd22e 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -3262,14 +3262,13 @@ nsLayoutUtils::SetFontFromStyle(nsIRenderingContext* aRC, nsStyleContext* aSC) static PRBool NonZeroStyleCoord(const nsStyleCoord& aCoord) { - switch (aCoord.GetUnit()) { - case eStyleUnit_Percent: - return aCoord.GetPercentValue() > 0; - case eStyleUnit_Coord: - return aCoord.GetCoordValue() > 0; - default: - return PR_TRUE; + if (aCoord.IsCoordPercentCalcUnit()) { + // Since negative results are clamped to 0, check > 0. + return nsRuleNode::ComputeCoordPercentCalc(aCoord, nscoord_MAX) > 0 || + nsRuleNode::ComputeCoordPercentCalc(aCoord, 0) > 0; } + + return PR_TRUE; } /* static */ PRBool diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 0fa7bac44a03..cf2f450e96f7 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -749,19 +749,15 @@ nsIFrame::ComputeBorderRadii(const nsStyleCorners& aBorderRadius, nscoord axis = NS_HALF_CORNER_IS_X(i) ? aFrameSize.width : aFrameSize.height; - switch (c.GetUnit()) { - case eStyleUnit_Percent: - aRadii[i] = (nscoord)(c.GetPercentValue() * axis); - break; - - case eStyleUnit_Coord: - aRadii[i] = c.GetCoordValue(); - break; - - default: - NS_NOTREACHED("ComputeBorderRadii: bad unit"); + if (c.IsCoordPercentCalcUnit()) { + aRadii[i] = nsRuleNode::ComputeCoordPercentCalc(c, axis); + if (aRadii[i] < 0) { + // clamp calc() aRadii[i] = 0; - break; + } + } else { + NS_NOTREACHED("ComputeBorderRadii: bad unit"); + aRadii[i] = 0; } } diff --git a/layout/reftests/css-calc/border-radius-1-ref.html b/layout/reftests/css-calc/border-radius-1-ref.html new file mode 100644 index 000000000000..c906eb97f711 --- /dev/null +++ b/layout/reftests/css-calc/border-radius-1-ref.html @@ -0,0 +1,13 @@ + +test for border-radius: calc() + +

diff --git a/layout/reftests/css-calc/border-radius-1.html b/layout/reftests/css-calc/border-radius-1.html new file mode 100644 index 000000000000..3dc740f0efe9 --- /dev/null +++ b/layout/reftests/css-calc/border-radius-1.html @@ -0,0 +1,13 @@ + +test for border-radius: calc() + +

diff --git a/layout/reftests/css-calc/reftest.list b/layout/reftests/css-calc/reftest.list index 9bd2ca21ee44..0daf129afd2e 100644 --- a/layout/reftests/css-calc/reftest.list +++ b/layout/reftests/css-calc/reftest.list @@ -1,3 +1,4 @@ +== border-radius-1.html border-radius-1-ref.html == height-block-1.html height-block-1-ref.html == height-table-1.html height-table-1-ref.html == margin-block-1.html margin-block-1-ref.html diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 7873fdb0fec7..de492fb9bc8e 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -5068,13 +5068,13 @@ CSSParserImpl::ParseBoxCornerRadius(nsCSSProperty aPropID) { nsCSSValue dimenX, dimenY; // required first value - if (! ParseNonNegativeVariant(dimenX, VARIANT_HLP, nsnull)) + if (! ParseNonNegativeVariant(dimenX, VARIANT_HLP | VARIANT_CALC, nsnull)) return PR_FALSE; // optional second value (forbidden if first value is inherit/initial) if (dimenX.GetUnit() != eCSSUnit_Inherit && dimenX.GetUnit() != eCSSUnit_Initial) { - ParseNonNegativeVariant(dimenY, VARIANT_LP, nsnull); + ParseNonNegativeVariant(dimenY, VARIANT_LP | VARIANT_CALC, nsnull); } if (dimenX == dimenY || dimenY.GetUnit() == eCSSUnit_Null) { @@ -5098,7 +5098,9 @@ CSSParserImpl::ParseBoxCornerRadii(const nsCSSProperty aPropIDs[]) NS_FOR_CSS_SIDES (side) { if (! ParseNonNegativeVariant(dimenX.*nsCSSRect::sides[side], - side > 0 ? VARIANT_LP : VARIANT_HLP, nsnull)) + (side > 0 ? 0 : VARIANT_INHERIT) | + VARIANT_LP | VARIANT_CALC, + nsnull)) break; countX++; } @@ -5108,7 +5110,7 @@ CSSParserImpl::ParseBoxCornerRadii(const nsCSSProperty aPropIDs[]) if (ExpectSymbol('/', PR_TRUE)) { NS_FOR_CSS_SIDES (side) { if (! ParseNonNegativeVariant(dimenY.*nsCSSRect::sides[side], - VARIANT_LP, nsnull)) + VARIANT_LP | VARIANT_CALC, nsnull)) break; countY++; } diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 2f4f7abfcd07..659e81110af5 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -5195,7 +5195,8 @@ nsRuleNode::ComputeBorderData(void* aStartStruct, nsStyleCoord coordX, coordY; if (SetPairCoords(radius, coordX, coordY, parentX, parentY, - SETCOORD_LPH | SETCOORD_INITIAL_ZERO, + SETCOORD_LPH | SETCOORD_INITIAL_ZERO | + SETCOORD_STORE_CALC, aContext, mPresContext, canStoreInRuleTree)) { border->mBorderRadius.Set(cx, coordX); border->mBorderRadius.Set(cy, coordY); @@ -5406,7 +5407,8 @@ nsRuleNode::ComputeOutlineData(void* aStartStruct, nsStyleCoord coordX, coordY; if (SetPairCoords(radius, coordX, coordY, parentX, parentY, - SETCOORD_LPH | SETCOORD_INITIAL_ZERO, + SETCOORD_LPH | SETCOORD_INITIAL_ZERO | + SETCOORD_STORE_CALC, aContext, mPresContext, canStoreInRuleTree)) { outline->mOutlineRadius.Set(cx, coordX); outline->mOutlineRadius.Set(cy, coordY); diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 906c4d6f6fd0..2a285a1809ef 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -749,7 +749,7 @@ struct nsStyleBorder { static PRBool ForceCompare() { return PR_FALSE; } PRBool ImageBorderDiffers() const; - nsStyleCorners mBorderRadius; // [reset] coord, percent + nsStyleCorners mBorderRadius; // [reset] coord, percent, calc nsStyleSides mBorderImageSplit; // [reset] integer, percent PRUint8 mFloatEdge; // [reset] see nsStyleConsts.h PRUint8 mBorderImageHFill; // [reset] @@ -972,7 +972,7 @@ struct nsStyleOutline { #endif static PRBool ForceCompare() { return PR_FALSE; } - nsStyleCorners mOutlineRadius; // [reset] coord, percent + nsStyleCorners mOutlineRadius; // [reset] coord, percent, calc // Note that this is a specified value. You can get the actual values // with GetOutlineWidth. You cannot get the computed value directly. diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 413b3620b37e..5bf6524b1faf 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -165,7 +165,18 @@ var gCSSProperties = { subproperties: [ "-moz-border-radius-bottomleft", "-moz-border-radius-bottomright", "-moz-border-radius-topleft", "-moz-border-radius-topright" ], initial_values: [ "0", "0px", "0px 0 0 0px" ], /* 0% ? */ other_values: [ "3%", "1px", "2em", "3em 2px", "2pt 3% 4em", "2px 2px 2px 2px", // circular - "3% / 2%", "1px / 4px", "2em / 1em", "3em 2px / 2px 3em", "2pt 3% 4em / 4pt 1% 5em", "2px 2px 2px 2px / 4px 4px 4px 4px", "1pt / 2pt 3pt", "4pt 5pt / 3pt" // elliptical + "3% / 2%", "1px / 4px", "2em / 1em", "3em 2px / 2px 3em", "2pt 3% 4em / 4pt 1% 5em", "2px 2px 2px 2px / 4px 4px 4px 4px", "1pt / 2pt 3pt", "4pt 5pt / 3pt", // elliptical + "-moz-calc(2px)", + "-moz-calc(50%)", + "-moz-calc(3*25px)", + "-moz-calc(3*25px) 5px", + "5px -moz-calc(3*25px)", + "-moz-calc(20%) -moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 50%)", + "-moz-min(30%, 30em,200px, min(500px ,40em))", + "2px 2px -moz-calc(2px + 1%) 2px", + "1px 2px 2px 2px / 2px 2px -moz-calc(2px + 1%) 2px", ], invalid_values: [ "2px -2px", "inherit 2px", "inherit / 2px", "2px inherit", "2px / inherit", "2px 2px 2px 2px 2px", "1px / 2px 2px 2px 2px 2px" ] }, @@ -175,7 +186,16 @@ var gCSSProperties = { type: CSS_TYPE_LONGHAND, initial_values: [ "0", "0px" ], /* 0% ? */ other_values: [ "3%", "1px", "2em", // circular - "3% 2%", "1px 4px", "2em 2pt" // elliptical + "3% 2%", "1px 4px", "2em 2pt", // elliptical + "-moz-calc(2px)", + "-moz-calc(50%)", + "-moz-calc(3*25px)", + "-moz-calc(3*25px) 5px", + "5px -moz-calc(3*25px)", + "-moz-calc(20%) -moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 50%)", + "-moz-min(30%, 30em,200px, min(500px ,40em))", ], invalid_values: [ "-1px", "4px -2px", "inherit 2px", "2px inherit" ] }, @@ -185,7 +205,16 @@ var gCSSProperties = { type: CSS_TYPE_LONGHAND, initial_values: [ "0", "0px" ], /* 0% ? */ other_values: [ "3%", "1px", "2em", // circular - "3% 2%", "1px 4px", "2em 2pt" // elliptical + "3% 2%", "1px 4px", "2em 2pt", // elliptical + "-moz-calc(2px)", + "-moz-calc(50%)", + "-moz-calc(3*25px)", + "-moz-calc(3*25px) 5px", + "5px -moz-calc(3*25px)", + "-moz-calc(20%) -moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 50%)", + "-moz-min(30%, 30em,200px, min(500px ,40em))", ], invalid_values: [ "-1px", "4px -2px", "inherit 2px", "2px inherit" ] }, @@ -195,7 +224,16 @@ var gCSSProperties = { type: CSS_TYPE_LONGHAND, initial_values: [ "0", "0px" ], /* 0% ? */ other_values: [ "3%", "1px", "2em", // circular - "3% 2%", "1px 4px", "2em 2pt" // elliptical + "3% 2%", "1px 4px", "2em 2pt", // elliptical + "-moz-calc(2px)", + "-moz-calc(50%)", + "-moz-calc(3*25px)", + "-moz-calc(3*25px) 5px", + "5px -moz-calc(3*25px)", + "-moz-calc(20%) -moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 50%)", + "-moz-min(30%, 30em,200px, min(500px ,40em))", ], invalid_values: [ "-1px", "4px -2px", "inherit 2px", "2px inherit" ] }, @@ -205,7 +243,16 @@ var gCSSProperties = { type: CSS_TYPE_LONGHAND, initial_values: [ "0", "0px" ], /* 0% ? */ other_values: [ "3%", "1px", "2em", // circular - "3% 2%", "1px 4px", "2em 2pt" // elliptical + "3% 2%", "1px 4px", "2em 2pt", // elliptical + "-moz-calc(2px)", + "-moz-calc(50%)", + "-moz-calc(3*25px)", + "-moz-calc(3*25px) 5px", + "5px -moz-calc(3*25px)", + "-moz-calc(20%) -moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 50%)", + "-moz-min(30%, 30em,200px, min(500px ,40em))", ], invalid_values: [ "-1px", "4px -2px", "inherit 2px", "2px inherit" ] }, @@ -607,7 +654,18 @@ var gCSSProperties = { subproperties: [ "-moz-outline-radius-bottomleft", "-moz-outline-radius-bottomright", "-moz-outline-radius-topleft", "-moz-outline-radius-topright" ], initial_values: [ "0", "0px", "0%" ], other_values: [ "3%", "1px", "2em", "3em 2px", "2pt 3% 4em", "2px 2px 2px 2px", // circular - "3% / 2%", "1px / 4px", "2em / 1em", "3em 2px / 2px 3em", "2pt 3% 4em / 4pt 1% 5em", "2px 2px 2px 2px / 4px 4px 4px 4px", "1pt / 2pt 3pt", "4pt 5pt / 3pt" // elliptical + "3% / 2%", "1px / 4px", "2em / 1em", "3em 2px / 2px 3em", "2pt 3% 4em / 4pt 1% 5em", "2px 2px 2px 2px / 4px 4px 4px 4px", "1pt / 2pt 3pt", "4pt 5pt / 3pt", // elliptical + "-moz-calc(2px)", + "-moz-calc(50%)", + "-moz-calc(3*25px)", + "-moz-calc(3*25px) 5px", + "5px -moz-calc(3*25px)", + "-moz-calc(20%) -moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 50%)", + "-moz-min(30%, 30em,200px, min(500px ,40em))", + "2px 2px -moz-calc(2px + 1%) 2px", + "1px 2px 2px 2px / 2px 2px -moz-calc(2px + 1%) 2px", ], invalid_values: [ "2px -2px", "inherit 2px", "inherit / 2px", "2px inherit", "2px / inherit", "2px 2px 2px 2px 2px", "1px / 2px 2px 2px 2px 2px" ] }, @@ -617,7 +675,16 @@ var gCSSProperties = { type: CSS_TYPE_LONGHAND, initial_values: [ "0", "0px", "0%" ], other_values: [ "3%", "1px", "2em", // circular - "3% 2%", "1px 4px", "2em 2pt" // elliptical + "3% 2%", "1px 4px", "2em 2pt", // elliptical + "-moz-calc(2px)", + "-moz-calc(50%)", + "-moz-calc(3*25px)", + "-moz-calc(3*25px) 5px", + "5px -moz-calc(3*25px)", + "-moz-calc(20%) -moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 50%)", + "-moz-min(30%, 30em,200px, min(500px ,40em))", ], invalid_values: [ "-1px", "4px -2px", "inherit 2px", "2px inherit" ] }, @@ -627,7 +694,16 @@ var gCSSProperties = { type: CSS_TYPE_LONGHAND, initial_values: [ "0", "0px", "0%" ], other_values: [ "3%", "1px", "2em", // circular - "3% 2%", "1px 4px", "2em 2pt" // elliptical + "3% 2%", "1px 4px", "2em 2pt", // elliptical + "-moz-calc(2px)", + "-moz-calc(50%)", + "-moz-calc(3*25px)", + "-moz-calc(3*25px) 5px", + "5px -moz-calc(3*25px)", + "-moz-calc(20%) -moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 50%)", + "-moz-min(30%, 30em,200px, min(500px ,40em))", ], invalid_values: [ "-1px", "4px -2px", "inherit 2px", "2px inherit" ] }, @@ -637,7 +713,16 @@ var gCSSProperties = { type: CSS_TYPE_LONGHAND, initial_values: [ "0", "0px", "0%" ], other_values: [ "3%", "1px", "2em", // circular - "3% 2%", "1px 4px", "2em 2pt" // elliptical + "3% 2%", "1px 4px", "2em 2pt", // elliptical + "-moz-calc(2px)", + "-moz-calc(50%)", + "-moz-calc(3*25px)", + "-moz-calc(3*25px) 5px", + "5px -moz-calc(3*25px)", + "-moz-calc(20%) -moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 50%)", + "-moz-min(30%, 30em,200px, min(500px ,40em))", ], invalid_values: [ "-1px", "4px -2px", "inherit 2px", "2px inherit" ] }, @@ -647,7 +732,16 @@ var gCSSProperties = { type: CSS_TYPE_LONGHAND, initial_values: [ "0", "0px", "0%" ], other_values: [ "3%", "1px", "2em", // circular - "3% 2%", "1px 4px", "2em 2pt" // elliptical + "3% 2%", "1px 4px", "2em 2pt", // elliptical + "-moz-calc(2px)", + "-moz-calc(50%)", + "-moz-calc(3*25px)", + "-moz-calc(3*25px) 5px", + "5px -moz-calc(3*25px)", + "-moz-calc(20%) -moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 50%)", + "-moz-min(30%, 30em,200px, min(500px ,40em))", ], invalid_values: [ "-1px", "4px -2px", "inherit 2px", "2px inherit" ] }, From 2842b508614d7e9ce313e4bc7111bf90b0d94964 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:46 -0700 Subject: [PATCH 050/176] Fix missing frame in style system mochitests. (Bug 585715) r=bzbarsky a2.0=blocking2.0:beta6 --- layout/style/test/property_database.js | 10 ++++++++++ layout/style/test/test_initial_computation.html | 9 +++++++++ layout/style/test/test_value_computation.html | 15 ++++++++++----- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 5bf6524b1faf..fe97ae6c7f56 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -162,6 +162,7 @@ var gCSSProperties = { domProp: "MozBorderRadius", inherited: false, type: CSS_TYPE_TRUE_SHORTHAND, + prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, subproperties: [ "-moz-border-radius-bottomleft", "-moz-border-radius-bottomright", "-moz-border-radius-topleft", "-moz-border-radius-topright" ], initial_values: [ "0", "0px", "0px 0 0 0px" ], /* 0% ? */ other_values: [ "3%", "1px", "2em", "3em 2px", "2pt 3% 4em", "2px 2px 2px 2px", // circular @@ -184,6 +185,7 @@ var gCSSProperties = { domProp: "MozBorderRadiusBottomleft", inherited: false, type: CSS_TYPE_LONGHAND, + prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, initial_values: [ "0", "0px" ], /* 0% ? */ other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical @@ -203,6 +205,7 @@ var gCSSProperties = { domProp: "MozBorderRadiusBottomright", inherited: false, type: CSS_TYPE_LONGHAND, + prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, initial_values: [ "0", "0px" ], /* 0% ? */ other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical @@ -222,6 +225,7 @@ var gCSSProperties = { domProp: "MozBorderRadiusTopleft", inherited: false, type: CSS_TYPE_LONGHAND, + prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, initial_values: [ "0", "0px" ], /* 0% ? */ other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical @@ -241,6 +245,7 @@ var gCSSProperties = { domProp: "MozBorderRadiusTopright", inherited: false, type: CSS_TYPE_LONGHAND, + prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, initial_values: [ "0", "0px" ], /* 0% ? */ other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical @@ -651,6 +656,7 @@ var gCSSProperties = { domProp: "MozOutlineRadius", inherited: false, type: CSS_TYPE_TRUE_SHORTHAND, + prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, subproperties: [ "-moz-outline-radius-bottomleft", "-moz-outline-radius-bottomright", "-moz-outline-radius-topleft", "-moz-outline-radius-topright" ], initial_values: [ "0", "0px", "0%" ], other_values: [ "3%", "1px", "2em", "3em 2px", "2pt 3% 4em", "2px 2px 2px 2px", // circular @@ -673,6 +679,7 @@ var gCSSProperties = { domProp: "MozOutlineRadiusBottomleft", inherited: false, type: CSS_TYPE_LONGHAND, + prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, initial_values: [ "0", "0px", "0%" ], other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical @@ -692,6 +699,7 @@ var gCSSProperties = { domProp: "MozOutlineRadiusBottomright", inherited: false, type: CSS_TYPE_LONGHAND, + prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, initial_values: [ "0", "0px", "0%" ], other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical @@ -711,6 +719,7 @@ var gCSSProperties = { domProp: "MozOutlineRadiusTopleft", inherited: false, type: CSS_TYPE_LONGHAND, + prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, initial_values: [ "0", "0px", "0%" ], other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical @@ -730,6 +739,7 @@ var gCSSProperties = { domProp: "MozOutlineRadiusTopright", inherited: false, type: CSS_TYPE_LONGHAND, + prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, initial_values: [ "0", "0px", "0%" ], other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical diff --git a/layout/style/test/test_initial_computation.html b/layout/style/test/test_initial_computation.html index 7e6f91cff4f1..a32bfb5b18fb 100644 --- a/layout/style/test/test_initial_computation.html +++ b/layout/style/test/test_initial_computation.html @@ -130,6 +130,15 @@ function test_property(property) gElementN.parentNode.style.removeProperty(property); gElementF.parentNode.style.removeProperty(property); } + + // FIXME: Something (maybe with the -moz-binding values in + // test_value_computation.html, but may as well do it here to match) + // causes gElementF's frame to get lost. Force it to get recreated + // after each property. + gElementF.parentNode.style.display = "none"; + get_computed_value(getComputedStyle(gElementF, ""), "width"); + gElementF.parentNode.style.display = ""; + get_computed_value(getComputedStyle(gElementF, ""), "width"); } function run_tests() { diff --git a/layout/style/test/test_value_computation.html b/layout/style/test/test_value_computation.html index c35fde4614ea..9ed38f08567a 100644 --- a/layout/style/test/test_value_computation.html +++ b/layout/style/test/test_value_computation.html @@ -43,22 +43,19 @@ var gBadComputed = { // These values are treated as auto. "page-break-after": [ "avoid" ], "page-break-before": [ "avoid" ], +}; +var gBadComputedNoFrame = { // These are probably bogus tests... "-moz-outline-radius": [ "0%" ], "-moz-outline-radius-bottomleft": [ "0%" ], "-moz-outline-radius-bottomright": [ "0%" ], "-moz-outline-radius-topleft": [ "0%" ], "-moz-outline-radius-topright": [ "0%" ], - // These are probably bogus tests... (why not just when no frame?) "-moz-margin-end": [ "0%" ], "-moz-margin-start": [ "0%" ], "-moz-padding-end": [ "0%" ], "-moz-padding-start": [ "0%" ], -}; - -var gBadComputedNoFrame = { - // These are probably bogus tests... "margin": [ "0% 0px 0em 0pt" ], "margin-bottom": [ "0%" ], "margin-left": [ "0%" ], @@ -197,6 +194,14 @@ function test_value(property, val, is_initial) gElementN.parentNode.style.removeProperty(property); gElementF.parentNode.style.removeProperty(property); } + + // FIXME: Something (maybe with the -moz-binding values) causes + // gElementF's frame to get lost. Force it to get recreated after + // each property. + gElementF.parentNode.style.display = "none"; + get_computed_value(getComputedStyle(gElementF, ""), "width"); + gElementF.parentNode.style.display = ""; + get_computed_value(getComputedStyle(gElementF, ""), "width"); } function test_property(prop) { From 99e16ca9a99ad44e84467c530cb3ba3a53df87ba Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:46 -0700 Subject: [PATCH 051/176] Fix places where I missed clamping negative calc() to 0. (Bug 585715) r=bzbarsky a2.0=blocking2.0:beta6 --- layout/base/nsLayoutUtils.h | 12 +++ layout/generic/nsContainerFrame.cpp | 6 +- layout/generic/nsFrame.cpp | 16 ++-- layout/generic/nsHTMLReflowState.cpp | 17 ++-- layout/generic/nsInlineFrame.cpp | 2 +- layout/style/nsComputedDOMStyle.cpp | 88 +++++++++++-------- layout/style/nsComputedDOMStyle.h | 4 +- layout/style/nsStyleStruct.cpp | 4 +- layout/style/test/property_database.js | 73 +++++++++------ layout/style/test/test_value_computation.html | 43 +++++---- 10 files changed, 168 insertions(+), 97 deletions(-) diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 2efa39f720a4..dfed9c5ef484 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -799,6 +799,18 @@ public: } static PRBool IsPaddingZero(const nsStyleCoord &aCoord) + { + return (aCoord.GetUnit() == eStyleUnit_Coord && + aCoord.GetCoordValue() == 0) || + (aCoord.GetUnit() == eStyleUnit_Percent && + aCoord.GetPercentValue() == 0.0) || + (aCoord.IsCalcUnit() && + // clamp negative calc() to 0 + nsRuleNode::ComputeCoordPercentCalc(aCoord, nscoord_MAX) <= 0 && + nsRuleNode::ComputeCoordPercentCalc(aCoord, 0) <= 0); + } + + static PRBool IsMarginZero(const nsStyleCoord &aCoord) { return (aCoord.GetUnit() == eStyleUnit_Coord && aCoord.GetCoordValue() == 0) || diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 43962fd83a94..601c16c823f5 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -629,7 +629,8 @@ nsContainerFrame::DoInlineIntrinsicWidth(nsIRenderingContext *aRenderingContext, // border. if (!GetPrevContinuation()) { aData->currentLine += - GetCoord(stylePadding->mPadding.Get(startSide), 0) + + // clamp negative calc() to 0 + NS_MAX(GetCoord(stylePadding->mPadding.Get(startSide), 0), 0) + styleBorder->GetActualBorderWidth(startSide) + GetCoord(styleMargin->mMargin.Get(startSide), 0); } @@ -670,7 +671,8 @@ nsContainerFrame::DoInlineIntrinsicWidth(nsIRenderingContext *aRenderingContext, // the endSide border. if (!lastInFlow->GetNextContinuation()) { aData->currentLine += - GetCoord(stylePadding->mPadding.Get(endSide), 0) + + // clamp negative calc() to 0 + NS_MAX(GetCoord(stylePadding->mPadding.Get(endSide), 0), 0) + styleBorder->GetActualBorderWidth(endSide) + GetCoord(styleMargin->mMargin.Get(endSide), 0); } diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index cf2f450e96f7..22fe1a7d6a6b 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -3249,7 +3249,8 @@ static void AddCoord(const nsStyleCoord& aStyle, nsIRenderingContext* aRenderingContext, nsIFrame* aFrame, - nscoord* aCoord, float* aPercent) + nscoord* aCoord, float* aPercent, + PRBool aClampNegativeToZero) { if (!aStyle.IsCoordPercentCalcUnit()) { return; @@ -3258,6 +3259,11 @@ AddCoord(const nsStyleCoord& aStyle, LengthPercentPairWithMinMaxCalcOps ops; LengthPercentPairWithMinMaxCalcOps::result_type pair = css::ComputeCalc(aStyle, ops); + if (aClampNegativeToZero) { + // This is far from ideal when one is negative and one is positive. + pair.mLength = NS_MAX(pair.mLength, 0); + pair.mPercent = NS_MAX(pair.mPercent, 0.0f); + } *aCoord += pair.mLength; *aPercent += pair.mPercent; } @@ -3273,15 +3279,15 @@ nsFrame::IntrinsicWidthOffsets(nsIRenderingContext* aRenderingContext) // comment above LengthPercentPairWithMinMaxCalcOps. const nsStyleMargin *styleMargin = GetStyleMargin(); AddCoord(styleMargin->mMargin.GetLeft(), aRenderingContext, this, - &result.hMargin, &result.hPctMargin); + &result.hMargin, &result.hPctMargin, PR_FALSE); AddCoord(styleMargin->mMargin.GetRight(), aRenderingContext, this, - &result.hMargin, &result.hPctMargin); + &result.hMargin, &result.hPctMargin, PR_FALSE); const nsStylePadding *stylePadding = GetStylePadding(); AddCoord(stylePadding->mPadding.GetLeft(), aRenderingContext, this, - &result.hPadding, &result.hPctPadding); + &result.hPadding, &result.hPctPadding, PR_TRUE); AddCoord(stylePadding->mPadding.GetRight(), aRenderingContext, this, - &result.hPadding, &result.hPctPadding); + &result.hPadding, &result.hPctPadding, PR_TRUE); const nsStyleBorder *styleBorder = GetStyleBorder(); result.hBorder += styleBorder->GetActualBorderWidth(NS_SIDE_LEFT); diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index 1d2ab65487f3..22ff785a5685 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -2187,21 +2187,22 @@ nsCSSOffsetState::ComputePadding(nscoord aContainingBlockWidth) const nsStylePadding *stylePadding = frame->GetStylePadding(); if (!stylePadding->GetPadding(mComputedPadding)) { // We have to compute the value - mComputedPadding.left = nsLayoutUtils:: + // clamp negative calc() results to 0 + mComputedPadding.left = NS_MAX(0, nsLayoutUtils:: ComputeWidthDependentValue(aContainingBlockWidth, - stylePadding->mPadding.GetLeft()); - mComputedPadding.right = nsLayoutUtils:: + stylePadding->mPadding.GetLeft())); + mComputedPadding.right = NS_MAX(0, nsLayoutUtils:: ComputeWidthDependentValue(aContainingBlockWidth, - stylePadding->mPadding.GetRight()); + stylePadding->mPadding.GetRight())); // According to the CSS2 spec, percentages are calculated with respect to // containing block width for padding-top and padding-bottom - mComputedPadding.top = nsLayoutUtils:: + mComputedPadding.top = NS_MAX(0, nsLayoutUtils:: ComputeWidthDependentValue(aContainingBlockWidth, - stylePadding->mPadding.GetTop()); - mComputedPadding.bottom = nsLayoutUtils:: + stylePadding->mPadding.GetTop())); + mComputedPadding.bottom = NS_MAX(0, nsLayoutUtils:: ComputeWidthDependentValue(aContainingBlockWidth, - stylePadding->mPadding.GetBottom()); + stylePadding->mPadding.GetBottom())); frame->Properties().Set(nsIFrame::UsedPaddingProperty(), new nsMargin(mComputedPadding)); diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp index fbf38d1a68b7..f4e603550a1c 100644 --- a/layout/generic/nsInlineFrame.cpp +++ b/layout/generic/nsInlineFrame.cpp @@ -97,7 +97,7 @@ static inline PRBool IsMarginZero(const nsStyleCoord &aCoord) { return aCoord.GetUnit() == eStyleUnit_Auto || - nsLayoutUtils::IsPaddingZero(aCoord); + nsLayoutUtils::IsMarginZero(aCoord); } /* virtual */ PRBool diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index a2a472e23c44..fdfe52907861 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -762,7 +762,7 @@ nsComputedDOMStyle::DoGetColumnWidth(nsIDOMCSSValue** aValue) // XXX fix the auto case. When we actually have a column frame, I think // we should return the computed column width. - SetValueToCoord(val, GetStyleColumn()->mColumnWidth); + SetValueToCoord(val, GetStyleColumn()->mColumnWidth, PR_TRUE); NS_ADDREF(*aValue = val); return NS_OK; @@ -778,7 +778,7 @@ nsComputedDOMStyle::DoGetColumnGap(nsIDOMCSSValue** aValue) if (column->mColumnGap.GetUnit() == eStyleUnit_Normal) { val->SetAppUnits(GetStyleFont()->mFont.size); } else { - SetValueToCoord(val, GetStyleColumn()->mColumnGap); + SetValueToCoord(val, GetStyleColumn()->mColumnGap, PR_TRUE); } NS_ADDREF(*aValue = val); @@ -1010,9 +1010,9 @@ nsComputedDOMStyle::DoGetMozTransformOrigin(nsIDOMCSSValue **aValue) /* Now, get the values. */ const nsStyleDisplay* display = GetStyleDisplay(); - SetValueToCoord(width, display->mTransformOrigin[0], + SetValueToCoord(width, display->mTransformOrigin[0], PR_FALSE, &nsComputedDOMStyle::GetFrameBoundsWidthForTransform); - SetValueToCoord(height, display->mTransformOrigin[1], + SetValueToCoord(height, display->mTransformOrigin[1], PR_FALSE, &nsComputedDOMStyle::GetFrameBoundsHeightForTransform); /* Store things as a value list, fail if we can't get one. */ @@ -1570,7 +1570,7 @@ nsComputedDOMStyle::GetImageRectString(nsIURI* aURI, delete valueList; return NS_ERROR_OUT_OF_MEMORY; } - SetValueToCoord(valSide, aCropRect.Get(side)); + SetValueToCoord(valSide, aCropRect.Get(side), PR_FALSE); } nsAutoString argumentString; @@ -2128,7 +2128,7 @@ nsComputedDOMStyle::DoGetMarkerOffset(nsIDOMCSSValue** aValue) nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - SetValueToCoord(val, GetStyleContent()->mMarkerOffset); + SetValueToCoord(val, GetStyleContent()->mMarkerOffset, PR_FALSE); NS_ADDREF(*aValue = val); return NS_OK; @@ -2262,7 +2262,7 @@ nsComputedDOMStyle::GetEllipseRadii(const nsStyleCorners& aRadius, nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - SetValueToCoord(val, radiusX, + SetValueToCoord(val, radiusX, PR_TRUE, &nsComputedDOMStyle::GetFrameBorderRectWidth); NS_ADDREF(*aValue = val); @@ -2286,9 +2286,9 @@ nsComputedDOMStyle::GetEllipseRadii(const nsStyleCorners& aRadius, return NS_ERROR_OUT_OF_MEMORY; } - SetValueToCoord(valX, radiusX, + SetValueToCoord(valX, radiusX, PR_TRUE, &nsComputedDOMStyle::GetFrameBorderRectWidth); - SetValueToCoord(valY, radiusY, + SetValueToCoord(valY, radiusY, PR_TRUE, &nsComputedDOMStyle::GetFrameBorderRectWidth); NS_ADDREF(*aValue = valueList); @@ -2403,7 +2403,7 @@ nsComputedDOMStyle::DoGetZIndex(nsIDOMCSSValue** aValue) nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - SetValueToCoord(val, GetStylePosition()->mZIndex); + SetValueToCoord(val, GetStylePosition()->mZIndex, PR_FALSE); NS_ADDREF(*aValue = val); return NS_OK; @@ -2521,7 +2521,7 @@ nsComputedDOMStyle::DoGetLineHeight(nsIDOMCSSValue** aValue) if (GetLineHeightCoord(lineHeight)) { val->SetAppUnits(lineHeight); } else { - SetValueToCoord(val, GetStyleText()->mLineHeight, + SetValueToCoord(val, GetStyleText()->mLineHeight, PR_TRUE, nsnull, nsCSSProps::kLineHeightKTable); } @@ -2535,7 +2535,7 @@ nsComputedDOMStyle::DoGetVerticalAlign(nsIDOMCSSValue** aValue) nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - SetValueToCoord(val, GetStyleTextReset()->mVerticalAlign, + SetValueToCoord(val, GetStyleTextReset()->mVerticalAlign, PR_FALSE, &nsComputedDOMStyle::GetLineHeightCoord, nsCSSProps::kVerticalAlignKTable); @@ -2590,7 +2590,7 @@ nsComputedDOMStyle::DoGetTextIndent(nsIDOMCSSValue** aValue) nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - SetValueToCoord(val, GetStyleText()->mTextIndent, + SetValueToCoord(val, GetStyleText()->mTextIndent, PR_FALSE, &nsComputedDOMStyle::GetCBContentWidth); NS_ADDREF(*aValue = val); @@ -2637,7 +2637,7 @@ nsComputedDOMStyle::DoGetLetterSpacing(nsIDOMCSSValue** aValue) nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - SetValueToCoord(val, GetStyleText()->mLetterSpacing); + SetValueToCoord(val, GetStyleText()->mLetterSpacing, PR_FALSE); NS_ADDREF(*aValue = val); return NS_OK; @@ -2960,8 +2960,7 @@ nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue) delete valueList; return NS_ERROR_OUT_OF_MEMORY; } - SetValueToCoord(valSplit, border->mBorderImageSplit.Get(side), nsnull, - nsnull); + SetValueToCoord(valSplit, border->mBorderImageSplit.Get(side), PR_TRUE); } // copy of border-width @@ -3332,14 +3331,14 @@ nsComputedDOMStyle::DoGetHeight(nsIDOMCSSValue** aValue) nscoord minHeight = StyleCoordToNSCoord(positionData->mMinHeight, - &nsComputedDOMStyle::GetCBContentHeight, 0); + &nsComputedDOMStyle::GetCBContentHeight, 0, PR_TRUE); nscoord maxHeight = StyleCoordToNSCoord(positionData->mMaxHeight, &nsComputedDOMStyle::GetCBContentHeight, - nscoord_MAX); + nscoord_MAX, PR_TRUE); - SetValueToCoord(val, positionData->mHeight, nsnull, nsnull, + SetValueToCoord(val, positionData->mHeight, PR_TRUE, nsnull, nsnull, minHeight, maxHeight); } @@ -3374,14 +3373,14 @@ nsComputedDOMStyle::DoGetWidth(nsIDOMCSSValue** aValue) nscoord minWidth = StyleCoordToNSCoord(positionData->mMinWidth, - &nsComputedDOMStyle::GetCBContentWidth, 0); + &nsComputedDOMStyle::GetCBContentWidth, 0, PR_TRUE); nscoord maxWidth = StyleCoordToNSCoord(positionData->mMaxWidth, &nsComputedDOMStyle::GetCBContentWidth, - nscoord_MAX); + nscoord_MAX, PR_TRUE); - SetValueToCoord(val, positionData->mWidth, nsnull, + SetValueToCoord(val, positionData->mWidth, PR_TRUE, nsnull, nsCSSProps::kWidthKTable, minWidth, maxWidth); } @@ -3395,7 +3394,7 @@ nsComputedDOMStyle::DoGetMaxHeight(nsIDOMCSSValue** aValue) nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - SetValueToCoord(val, GetStylePosition()->mMaxHeight, + SetValueToCoord(val, GetStylePosition()->mMaxHeight, PR_TRUE, &nsComputedDOMStyle::GetCBContentHeight); NS_ADDREF(*aValue = val); @@ -3408,7 +3407,7 @@ nsComputedDOMStyle::DoGetMaxWidth(nsIDOMCSSValue** aValue) nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - SetValueToCoord(val, GetStylePosition()->mMaxWidth, + SetValueToCoord(val, GetStylePosition()->mMaxWidth, PR_TRUE, &nsComputedDOMStyle::GetCBContentWidth, nsCSSProps::kWidthKTable); @@ -3422,7 +3421,7 @@ nsComputedDOMStyle::DoGetMinHeight(nsIDOMCSSValue** aValue) nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - SetValueToCoord(val, GetStylePosition()->mMinHeight, + SetValueToCoord(val, GetStylePosition()->mMinHeight, PR_TRUE, &nsComputedDOMStyle::GetCBContentHeight); NS_ADDREF(*aValue = val); @@ -3435,7 +3434,7 @@ nsComputedDOMStyle::DoGetMinWidth(nsIDOMCSSValue** aValue) nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - SetValueToCoord(val, GetStylePosition()->mMinWidth, + SetValueToCoord(val, GetStylePosition()->mMinWidth, PR_TRUE, &nsComputedDOMStyle::GetCBContentWidth, nsCSSProps::kWidthKTable); @@ -3611,7 +3610,7 @@ nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side aSide, baseGetter = &nsComputedDOMStyle::GetCBContentHeight; } - val->SetAppUnits(sign * StyleCoordToNSCoord(coord, baseGetter, 0)); + val->SetAppUnits(sign * StyleCoordToNSCoord(coord, baseGetter, 0, PR_FALSE)); NS_ADDREF(*aValue = val); return NS_OK; @@ -3624,7 +3623,7 @@ nsComputedDOMStyle::GetStaticOffset(mozilla::css::Side aSide, nsIDOMCSSValue** a nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - SetValueToCoord(val, GetStylePosition()->mOffset.Get(aSide)); + SetValueToCoord(val, GetStylePosition()->mOffset.Get(aSide), PR_FALSE); NS_ADDREF(*aValue = val); return NS_OK; @@ -3637,7 +3636,7 @@ nsComputedDOMStyle::GetPaddingWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue* NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); if (!mInnerFrame) { - SetValueToCoord(val, GetStylePadding()->mPadding.Get(aSide)); + SetValueToCoord(val, GetStylePadding()->mPadding.Get(aSide), PR_TRUE); } else { AssertFlushedPendingReflows(); @@ -3778,7 +3777,7 @@ nsComputedDOMStyle::GetMarginWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); if (!mInnerFrame) { - SetValueToCoord(val, GetStyleMargin()->mMargin.Get(aSide)); + SetValueToCoord(val, GetStyleMargin()->mMargin.Get(aSide), PR_FALSE); } else { AssertFlushedPendingReflows(); @@ -3854,6 +3853,7 @@ private: void nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue, const nsStyleCoord& aCoord, + PRBool aClampNegativeCalc, PercentageBaseGetter aPercentageBaseGetter, const PRInt32 aTable[], nscoord aMinAppUnits, @@ -3914,11 +3914,21 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue, nscoord percentageBase; if (!aCoord.CalcHasPercent()) { nscoord val = nsRuleNode::ComputeCoordPercentCalc(aCoord, 0); + if (aClampNegativeCalc && val < 0) { + NS_ABORT_IF_FALSE(aCoord.IsCalcUnit(), + "parser should have rejected value"); + val = 0; + } aValue->SetAppUnits(NS_MAX(aMinAppUnits, NS_MIN(val, aMaxAppUnits))); } else if (aPercentageBaseGetter && (this->*aPercentageBaseGetter)(percentageBase)) { nscoord val = nsRuleNode::ComputeCoordPercentCalc(aCoord, percentageBase); + if (aClampNegativeCalc && val < 0) { + NS_ABORT_IF_FALSE(aCoord.IsCalcUnit(), + "parser should have rejected value"); + val = 0; + } aValue->SetAppUnits(NS_MAX(aMinAppUnits, NS_MIN(val, aMaxAppUnits))); } else { nsAutoString tmp; @@ -3936,7 +3946,8 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue, nscoord nsComputedDOMStyle::StyleCoordToNSCoord(const nsStyleCoord& aCoord, PercentageBaseGetter aPercentageBaseGetter, - nscoord aDefaultValue) + nscoord aDefaultValue, + PRBool aClampNegativeCalc) { NS_PRECONDITION(aPercentageBaseGetter, "Must have a percentage base getter"); if (aCoord.GetUnit() == eStyleUnit_Coord) { @@ -3945,7 +3956,14 @@ nsComputedDOMStyle::StyleCoordToNSCoord(const nsStyleCoord& aCoord, if (aCoord.GetUnit() == eStyleUnit_Percent || aCoord.IsCalcUnit()) { nscoord percentageBase; if ((this->*aPercentageBaseGetter)(percentageBase)) { - return nsRuleNode::ComputeCoordPercentCalc(aCoord, percentageBase); + nscoord result = + nsRuleNode::ComputeCoordPercentCalc(aCoord, percentageBase); + if (aClampNegativeCalc && result < 0) { + NS_ABORT_IF_FALSE(aCoord.IsCalcUnit(), + "parser should have rejected value"); + result = 0; + } + return result; } // Fall through to returning aDefaultValue if we have no percentage base. } @@ -4191,7 +4209,7 @@ nsComputedDOMStyle::DoGetStrokeDasharray(nsIDOMCSSValue** aValue) return NS_ERROR_OUT_OF_MEMORY; } - SetValueToCoord(dash, svg->mStrokeDasharray[i]); + SetValueToCoord(dash, svg->mStrokeDasharray[i], PR_TRUE); } NS_ADDREF(*aValue = valueList); @@ -4204,7 +4222,7 @@ nsComputedDOMStyle::DoGetStrokeDashoffset(nsIDOMCSSValue** aValue) nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - SetValueToCoord(val, GetStyleSVG()->mStrokeDashoffset); + SetValueToCoord(val, GetStyleSVG()->mStrokeDashoffset, PR_FALSE); NS_ADDREF(*aValue = val); return NS_OK; @@ -4216,7 +4234,7 @@ nsComputedDOMStyle::DoGetStrokeWidth(nsIDOMCSSValue** aValue) nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); - SetValueToCoord(val, GetStyleSVG()->mStrokeWidth); + SetValueToCoord(val, GetStyleSVG()->mStrokeWidth, PR_TRUE); NS_ADDREF(*aValue = val); return NS_OK; diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index f4a3e48d7210..aa3bdb4fabef 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -428,6 +428,7 @@ private: */ void SetValueToCoord(nsROCSSPrimitiveValue* aValue, const nsStyleCoord& aCoord, + PRBool aClampNegativeCalc, PercentageBaseGetter aPercentageBaseGetter = nsnull, const PRInt32 aTable[] = nsnull, nscoord aMinAppUnits = nscoord_MIN, @@ -441,7 +442,8 @@ private: */ nscoord StyleCoordToNSCoord(const nsStyleCoord& aCoord, PercentageBaseGetter aPercentageBaseGetter, - nscoord aDefaultValue); + nscoord aDefaultValue, + PRBool aClampNegativeCalc); PRBool GetCBContentWidth(nscoord& aWidth); PRBool GetCBContentHeight(nscoord& aWidth); diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index e381a229cdae..c693648ea14c 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -344,7 +344,9 @@ void nsStylePadding::RecalcData() { if (IsFixedData(mPadding, PR_FALSE)) { NS_FOR_CSS_SIDES(side) { - mCachedPadding.side(side) = CalcCoord(mPadding.Get(side), nsnull, 0); + // Clamp negative calc() to 0. + mCachedPadding.side(side) = + NS_MAX(CalcCoord(mPadding.Get(side), nsnull, 0), 0); } mHasCachedPadding = PR_TRUE; } diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index fe97ae6c7f56..385686655498 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -164,7 +164,7 @@ var gCSSProperties = { type: CSS_TYPE_TRUE_SHORTHAND, prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, subproperties: [ "-moz-border-radius-bottomleft", "-moz-border-radius-bottomright", "-moz-border-radius-topleft", "-moz-border-radius-topright" ], - initial_values: [ "0", "0px", "0px 0 0 0px" ], /* 0% ? */ + initial_values: [ "0", "0px", "0%", "0px 0 0 0px", "-moz-calc(-2px)", "-moz-calc(-1%)", "-moz-calc(0px) -moz-calc(0pt) -moz-calc(0%) -moz-calc(0em)" ], other_values: [ "3%", "1px", "2em", "3em 2px", "2pt 3% 4em", "2px 2px 2px 2px", // circular "3% / 2%", "1px / 4px", "2em / 1em", "3em 2px / 2px 3em", "2pt 3% 4em / 4pt 1% 5em", "2px 2px 2px 2px / 4px 4px 4px 4px", "1pt / 2pt 3pt", "4pt 5pt / 3pt", // elliptical "-moz-calc(2px)", @@ -186,7 +186,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, - initial_values: [ "0", "0px" ], /* 0% ? */ + initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)" ], other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical "-moz-calc(2px)", @@ -206,7 +206,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, - initial_values: [ "0", "0px" ], /* 0% ? */ + initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)" ], other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical "-moz-calc(2px)", @@ -226,7 +226,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, - initial_values: [ "0", "0px" ], /* 0% ? */ + initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)" ], other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical "-moz-calc(2px)", @@ -246,7 +246,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, - initial_values: [ "0", "0px" ], /* 0% ? */ + initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)" ], other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical "-moz-calc(2px)", @@ -377,6 +377,8 @@ var gCSSProperties = { "2px -moz-min(2px,0.2em)", "blue 2px -moz-min(2px,0.2em)", "2px -moz-min(2px,0.2em) blue", + "-moz-calc(-2px) -moz-calc(-2px)", + "-2px -2px", "-moz-calc(2px) -moz-calc(2px)", "-moz-calc(2px) -moz-calc(2px) -moz-calc(2px)", "-moz-calc(2px) -moz-calc(2px) -moz-calc(2px) -moz-calc(2px)" @@ -623,9 +625,10 @@ var gCSSProperties = { get_computed: logical_box_prop_get_computed, /* no subproperties */ /* auto may or may not be initial */ - initial_values: [ "0", "0px", "0%", "0em", "0ex" ], + initial_values: [ "0", "0px", "0%", "0em", "0ex", "-moz-calc(0pt)", "-moz-calc(0% + 0px)" ], other_values: [ "1px", "3em", "-moz-calc(2px)", + "-moz-calc(-2px)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", @@ -641,9 +644,10 @@ var gCSSProperties = { get_computed: logical_box_prop_get_computed, /* no subproperties */ /* auto may or may not be initial */ - initial_values: [ "0", "0px", "0%", "0em", "0ex" ], + initial_values: [ "0", "0px", "0%", "0em", "0ex", "-moz-calc(0pt)", "-moz-calc(0% + 0px)" ], other_values: [ "1px", "3em", "-moz-calc(2px)", + "-moz-calc(-2px)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", @@ -658,7 +662,7 @@ var gCSSProperties = { type: CSS_TYPE_TRUE_SHORTHAND, prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, subproperties: [ "-moz-outline-radius-bottomleft", "-moz-outline-radius-bottomright", "-moz-outline-radius-topleft", "-moz-outline-radius-topright" ], - initial_values: [ "0", "0px", "0%" ], + initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)", "-moz-calc(0px) -moz-calc(0pt) -moz-calc(0%) -moz-calc(0em)" ], other_values: [ "3%", "1px", "2em", "3em 2px", "2pt 3% 4em", "2px 2px 2px 2px", // circular "3% / 2%", "1px / 4px", "2em / 1em", "3em 2px / 2px 3em", "2pt 3% 4em / 4pt 1% 5em", "2px 2px 2px 2px / 4px 4px 4px 4px", "1pt / 2pt 3pt", "4pt 5pt / 3pt", // elliptical "-moz-calc(2px)", @@ -680,7 +684,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, - initial_values: [ "0", "0px", "0%" ], + initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)", "-moz-calc(0px)" ], other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical "-moz-calc(2px)", @@ -700,7 +704,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, - initial_values: [ "0", "0px", "0%" ], + initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)", "-moz-calc(0px)" ], other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical "-moz-calc(2px)", @@ -720,7 +724,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, - initial_values: [ "0", "0px", "0%" ], + initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)", "-moz-calc(0px)" ], other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical "-moz-calc(2px)", @@ -740,7 +744,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"}, - initial_values: [ "0", "0px", "0%" ], + initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)", "-moz-calc(0px)" ], other_values: [ "3%", "1px", "2em", // circular "3% 2%", "1px 4px", "2em 2pt", // elliptical "-moz-calc(2px)", @@ -761,7 +765,7 @@ var gCSSProperties = { type: CSS_TYPE_SHORTHAND_AND_LONGHAND, get_computed: logical_box_prop_get_computed, /* no subproperties */ - initial_values: [ "0", "0px", "0%", "0em", "0ex" ], + initial_values: [ "0", "0px", "0%", "0em", "0ex", "-moz-calc(0pt)", "-moz-calc(0% + 0px)", "-moz-calc(-3px)", "-moz-calc(-1%)" ], other_values: [ "1px", "3em", "-moz-calc(2px)", "-moz-calc(50%)", @@ -778,7 +782,7 @@ var gCSSProperties = { type: CSS_TYPE_SHORTHAND_AND_LONGHAND, get_computed: logical_box_prop_get_computed, /* no subproperties */ - initial_values: [ "0", "0px", "0%", "0em", "0ex" ], + initial_values: [ "0", "0px", "0%", "0em", "0ex", "-moz-calc(0pt)", "-moz-calc(0% + 0px)", "-moz-calc(-3px)", "-moz-calc(-1%)" ], other_values: [ "1px", "3em", "-moz-calc(2px)", "-moz-calc(50%)", @@ -1475,6 +1479,7 @@ var gCSSProperties = { initial_values: [ "auto" ], other_values: [ "32px", "-3em", "12%", "-moz-calc(2px)", + "-moz-calc(-2px)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", @@ -1720,6 +1725,7 @@ var gCSSProperties = { domProp: "height", inherited: false, type: CSS_TYPE_LONGHAND, + /* FIXME: test zero, and test calc clamping */ initial_values: [ " auto" ], /* computed value tests for height test more with display:block */ prerequisites: { "display": "block" }, @@ -1751,6 +1757,7 @@ var gCSSProperties = { initial_values: [ "auto" ], other_values: [ "32px", "-3em", "12%", "-moz-calc(2px)", + "-moz-calc(-2px)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", @@ -1855,9 +1862,10 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, /* XXX testing auto has prerequisites */ - initial_values: [ "0", "0px", "0%" ], + initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)" ], other_values: [ "1px", "2em", "5%", "-moz-calc(2px)", + "-moz-calc(-2px)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", @@ -1872,9 +1880,10 @@ var gCSSProperties = { type: CSS_TYPE_SHORTHAND_AND_LONGHAND, /* no subproperties */ /* XXX testing auto has prerequisites */ - initial_values: [ "0", "0px", "0%" ], + initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)" ], other_values: [ "1px", "2em", "5%", ".5px", "+32px", "+.789px", "-.328px", "+0.56px", "-0.974px", "237px", "-289px", "-056px", "1987.45px", "-84.32px", "-moz-calc(2px)", + "-moz-calc(-2px)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", @@ -1889,9 +1898,10 @@ var gCSSProperties = { type: CSS_TYPE_SHORTHAND_AND_LONGHAND, /* no subproperties */ /* XXX testing auto has prerequisites */ - initial_values: [ "0", "0px", "0%" ], + initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)" ], other_values: [ "1px", "2em", "5%", "-moz-calc(2px)", + "-moz-calc(-2px)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", @@ -1905,9 +1915,10 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, /* XXX testing auto has prerequisites */ - initial_values: [ "0", "0px", "0%" ], + initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)" ], other_values: [ "1px", "2em", "5%", "-moz-calc(2px)", + "-moz-calc(-2px)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", @@ -1942,6 +1953,8 @@ var gCSSProperties = { initial_values: [ "none" ], other_values: [ "30px", "50%", "0", "-moz-calc(2px)", + "-moz-calc(-2px)", + "-moz-calc(0)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", @@ -1958,6 +1971,8 @@ var gCSSProperties = { initial_values: [ "none" ], other_values: [ "30px", "50%", "0", "-moz-max-content", "-moz-min-content", "-moz-fit-content", "-moz-available", "-moz-calc(2px)", + "-moz-calc(-2px)", + "-moz-calc(0)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", @@ -1971,7 +1986,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "display": "block" }, - initial_values: [ "0" ], + initial_values: [ "0", "-moz-calc(0em)", "-moz-calc(-2px)", "-moz-calc(-1%)" ], other_values: [ "30px", "50%", "-moz-calc(2px)", "-moz-calc(50%)", @@ -1987,7 +2002,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "display": "block" }, - initial_values: [ "0" ], + initial_values: [ "0", "-moz-calc(0em)", "-moz-calc(-2px)", "-moz-calc(-1%)" ], other_values: [ "30px", "50%", "-moz-max-content", "-moz-min-content", "-moz-fit-content", "-moz-available", "-moz-calc(2px)", "-moz-calc(50%)", @@ -2098,7 +2113,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_TRUE_SHORTHAND, subproperties: [ "padding-top", "padding-right", "padding-bottom", "padding-left" ], - initial_values: [ "0", "0px 0 0em", "0% 0px 0em 0pt" ], + initial_values: [ "0", "0px 0 0em", "0% 0px 0em 0pt", "-moz-calc(0) -moz-calc(0em) -moz-calc(-2px) -moz-calc(-1%)" ], other_values: [ "3px 0", "2em 4px 2pt", "1em 2em 3px 4px" ], invalid_values: [] }, @@ -2106,7 +2121,7 @@ var gCSSProperties = { domProp: "paddingBottom", inherited: false, type: CSS_TYPE_LONGHAND, - initial_values: [ "0", "0px", "0%" ], + initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)", "-moz-calc(-3px)", "-moz-calc(-1%)" ], other_values: [ "1px", "2em", "5%", "-moz-calc(2px)", "-moz-calc(50%)", @@ -2122,7 +2137,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_SHORTHAND_AND_LONGHAND, /* no subproperties */ - initial_values: [ "0", "0px", "0%" ], + initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)", "-moz-calc(-3px)", "-moz-calc(-1%)" ], other_values: [ "1px", "2em", "5%", "-moz-calc(2px)", "-moz-calc(50%)", @@ -2138,7 +2153,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_SHORTHAND_AND_LONGHAND, /* no subproperties */ - initial_values: [ "0", "0px", "0%" ], + initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)", "-moz-calc(-3px)", "-moz-calc(-1%)" ], other_values: [ "1px", "2em", "5%", "-moz-calc(2px)", "-moz-calc(50%)", @@ -2153,7 +2168,7 @@ var gCSSProperties = { domProp: "paddingTop", inherited: false, type: CSS_TYPE_LONGHAND, - initial_values: [ "0", "0px", "0%" ], + initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)", "-moz-calc(-3px)", "-moz-calc(-1%)" ], other_values: [ "1px", "2em", "5%", "-moz-calc(2px)", "-moz-calc(50%)", @@ -2289,6 +2304,7 @@ var gCSSProperties = { initial_values: [ "auto" ], other_values: [ "32px", "-3em", "12%", "-moz-calc(2px)", + "-moz-calc(-2px)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", @@ -2395,9 +2411,10 @@ var gCSSProperties = { domProp: "textIndent", inherited: true, type: CSS_TYPE_LONGHAND, - initial_values: [ "0" ], + initial_values: [ "0", "-moz-calc(3em - 5em + 2px + 2em - 2px)" ], other_values: [ "2em", "5%", "-10px", "-moz-calc(2px)", + "-moz-calc(-2px)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", @@ -2420,6 +2437,8 @@ var gCSSProperties = { "2px -moz-min(2px,0.2em)", "blue 2px -moz-min(2px,0.2em)", "2px -moz-min(2px,0.2em) blue", + "-moz-calc(-2px) -moz-calc(-2px)", + "-2px -2px", "-moz-calc(2px) -moz-calc(2px)", "-moz-calc(2px) -moz-calc(2px) -moz-calc(2px)", ], @@ -2445,6 +2464,7 @@ var gCSSProperties = { initial_values: [ "auto" ], other_values: [ "32px", "-3em", "12%", "-moz-calc(2px)", + "-moz-calc(-2px)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", @@ -2509,6 +2529,7 @@ var gCSSProperties = { initial_values: [ "baseline" ], other_values: [ "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom", "15%", "3px", "0.2em", "-5px", "-3%", "-moz-calc(2px)", + "-moz-calc(-2px)", "-moz-calc(50%)", "-moz-calc(3*25px)", "-moz-calc(25px*3)", diff --git a/layout/style/test/test_value_computation.html b/layout/style/test/test_value_computation.html index 9ed38f08567a..34bbac709ee9 100644 --- a/layout/style/test/test_value_computation.html +++ b/layout/style/test/test_value_computation.html @@ -47,25 +47,32 @@ var gBadComputed = { var gBadComputedNoFrame = { // These are probably bogus tests... - "-moz-outline-radius": [ "0%" ], - "-moz-outline-radius-bottomleft": [ "0%" ], - "-moz-outline-radius-bottomright": [ "0%" ], - "-moz-outline-radius-topleft": [ "0%" ], - "-moz-outline-radius-topright": [ "0%" ], - "-moz-margin-end": [ "0%" ], - "-moz-margin-start": [ "0%" ], - "-moz-padding-end": [ "0%" ], - "-moz-padding-start": [ "0%" ], + "-moz-border-radius": [ "0%", "-moz-calc(-1%)", "-moz-calc(0px) -moz-calc(0pt) -moz-calc(0%) -moz-calc(0em)" ], + "-moz-border-radius-bottomleft": [ "0%", "-moz-calc(-1%)" ], + "-moz-border-radius-bottomright": [ "0%", "-moz-calc(-1%)" ], + "-moz-border-radius-topleft": [ "0%", "-moz-calc(-1%)" ], + "-moz-border-radius-topright": [ "0%", "-moz-calc(-1%)" ], + "-moz-margin-end": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ], + "-moz-margin-start": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ], + "-moz-outline-radius": [ "0%", "-moz-calc(-1%)", "-moz-calc(0px) -moz-calc(0pt) -moz-calc(0%) -moz-calc(0em)" ], + "-moz-outline-radius-bottomleft": [ "0%", "-moz-calc(-1%)" ], + "-moz-outline-radius-bottomright": [ "0%", "-moz-calc(-1%)" ], + "-moz-outline-radius-topleft": [ "0%", "-moz-calc(-1%)" ], + "-moz-outline-radius-topright": [ "0%", "-moz-calc(-1%)" ], + "-moz-padding-end": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ], + "-moz-padding-start": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ], "margin": [ "0% 0px 0em 0pt" ], - "margin-bottom": [ "0%" ], - "margin-left": [ "0%" ], - "margin-right": [ "0%" ], - "margin-top": [ "0%" ], - "padding": [ "0% 0px 0em 0pt" ], - "padding-bottom": [ "0%" ], - "padding-left": [ "0%" ], - "padding-right": [ "0%" ], - "padding-top": [ "0%" ], + "margin-bottom": [ "0%", "-moz-calc(0% + 0px)" ], + "margin-left": [ "0%", "-moz-calc(0% + 0px)" ], + "margin-right": [ "0%", "-moz-calc(0% + 0px)" ], + "margin-top": [ "0%", "-moz-calc(0% + 0px)" ], + "min-height": [ "-moz-calc(-1%)" ], + "min-width": [ "-moz-calc(-1%)" ], + "padding": [ "0% 0px 0em 0pt", "-moz-calc(0) -moz-calc(0em) -moz-calc(-2px) -moz-calc(-1%)" ], + "padding-bottom": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ], + "padding-left": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ], + "padding-right": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ], + "padding-top": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ], }; function xfail_value(property, value, is_initial, has_frame) { From 7a0e99bcfb1c358b9d14fd86c80dbe5186b2ec29 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:46 -0700 Subject: [PATCH 052/176] Negative values for stroke-dasharray should be rejected. (Bug 585715) r=bzbarsky a2.0=blocking2.0:beta6 --- layout/style/nsCSSParser.cpp | 5 ++--- layout/style/test/property_database.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index de492fb9bc8e..c9e51fb58569 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -154,6 +154,7 @@ namespace css = mozilla::css; #define VARIANT_HN (VARIANT_INHERIT | VARIANT_NUMBER) #define VARIANT_HON (VARIANT_HN | VARIANT_NONE) #define VARIANT_HOS (VARIANT_INHERIT | VARIANT_NONE | VARIANT_STRING) +#define VARIANT_LPN (VARIANT_LP | VARIANT_NUMBER) #define VARIANT_TIMING_FUNCTION (VARIANT_KEYWORD | VARIANT_CUBIC_BEZIER) #define VARIANT_UK (VARIANT_URL | VARIANT_KEYWORD) #define VARIANT_UO (VARIANT_URL | VARIANT_NONE) @@ -9034,9 +9035,7 @@ CSSParserImpl::ParseDasharray() } else { nsCSSValueList *cur = value.SetListValue(); for (;;) { - if (!ParseVariant(cur->mValue, - VARIANT_LENGTH | VARIANT_PERCENT | VARIANT_NUMBER, - nsnull)) { + if (!ParseNonNegativeVariant(cur->mValue, VARIANT_LPN, nsnull)) { return PR_FALSE; } if (CheckEndProperty()) { diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 385686655498..8f012994ca98 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -2867,7 +2867,7 @@ var gCSSProperties = { type: CSS_TYPE_LONGHAND, initial_values: [ "none" ], other_values: [ "5px,3px,2px", "5px 3px 2px", " 5px ,3px , 2px ", "1px", "5%", "3em" ], - invalid_values: [] + invalid_values: [ "-5px,3px,2px", "5px,3px,-2px" ] }, "stroke-dashoffset": { domProp: "strokeDashoffset", From d282153a9dc5bc1e67de72367747badfe8ddd189 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:46 -0700 Subject: [PATCH 053/176] Add calc() support for two properties I missed: outline-width and column-gap. (Bug 363249) r=bzbarsky a2.0=blocking2.0:beta6 --- layout/style/nsCSSParser.cpp | 5 +++-- layout/style/nsRuleNode.cpp | 13 +++++++++--- layout/style/nsStyleStruct.cpp | 3 ++- layout/style/test/property_database.js | 28 ++++++++++++++++++++++---- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index c9e51fb58569..02442232886f 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -5640,7 +5640,8 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue, case eCSSProperty__moz_column_width: return ParseNonNegativeVariant(aValue, VARIANT_AHL | VARIANT_CALC, nsnull); case eCSSProperty__moz_column_gap: - return ParseNonNegativeVariant(aValue, VARIANT_HL | VARIANT_NORMAL, nsnull); + return ParseNonNegativeVariant(aValue, VARIANT_HL | VARIANT_NORMAL | + VARIANT_CALC, nsnull); case eCSSProperty_bottom: case eCSSProperty_top: case eCSSProperty_left: @@ -5860,7 +5861,7 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue, return ParseVariant(aValue, VARIANT_HK, nsCSSProps::kOutlineStyleKTable); case eCSSProperty_outline_width: - return ParseNonNegativeVariant(aValue, VARIANT_HKL, + return ParseNonNegativeVariant(aValue, VARIANT_HKL | VARIANT_CALC, nsCSSProps::kBorderWidthKTable); case eCSSProperty_outline_offset: return ParseVariant(aValue, VARIANT_HL | VARIANT_CALC, nsnull); diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 659e81110af5..dc5ea149e480 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -5345,7 +5345,8 @@ nsRuleNode::ComputeOutlineData(void* aStartStruct, } else { SetCoord(marginData.mOutlineWidth, outline->mOutlineWidth, - parentOutline->mOutlineWidth, SETCOORD_LEH, aContext, + parentOutline->mOutlineWidth, + SETCOORD_LEH | SETCOORD_CALC_LENGTH_ONLY, aContext, mPresContext, canStoreInRuleTree); } @@ -6024,11 +6025,17 @@ nsRuleNode::ComputeColumnData(void* aStartStruct, SETCOORD_CALC_LENGTH_ONLY | SETCOORD_CALC_CLAMP_NONNEGATIVE, aContext, mPresContext, canStoreInRuleTree); - // column-gap: length, percentage, inherit, normal + // column-gap: length, inherit, normal SetCoord(columnData.mColumnGap, column->mColumnGap, parent->mColumnGap, - SETCOORD_LPH | SETCOORD_NORMAL | SETCOORD_INITIAL_NORMAL, + SETCOORD_LH | SETCOORD_NORMAL | SETCOORD_INITIAL_NORMAL | + SETCOORD_CALC_LENGTH_ONLY, aContext, mPresContext, canStoreInRuleTree); + // clamp negative calc() to 0 + if (column->mColumnGap.GetUnit() == eStyleUnit_Coord) { + column->mColumnGap.SetCoordValue( + NS_MAX(column->mColumnGap.GetCoordValue(), 0)); + } // column-count: auto, integer, inherit if (eCSSUnit_Auto == columnData.mColumnCount.GetUnit() || diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index c693648ea14c..b0b472f31f93 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -630,8 +630,9 @@ nsStyleOutline::RecalcData(nsPresContext* aContext) mCachedOutlineWidth = 0; mHasCachedOutline = PR_TRUE; } else if (IsFixedUnit(mOutlineWidth, PR_TRUE)) { + // Clamp negative calc() to 0. mCachedOutlineWidth = - CalcCoord(mOutlineWidth, aContext->GetBorderWidthTable(), 3); + NS_MAX(CalcCoord(mOutlineWidth, aContext->GetBorderWidthTable(), 3), 0); mCachedOutlineWidth = NS_ROUND_BORDER_TO_PIXELS(mCachedOutlineWidth, mTwipsPerPixel); mHasCachedOutline = PR_TRUE; diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 8f012994ca98..54b8c625ae94 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -406,8 +406,18 @@ var gCSSProperties = { domProp: "MozColumnGap", inherited: false, type: CSS_TYPE_LONGHAND, - initial_values: [ "normal", "1em" ], - other_values: [ "2px", "4em" ], + initial_values: [ "normal", "1em", "-moz-calc(-2em + 3em)" ], + other_values: [ "2px", "4em", + "-moz-calc(2px)", + "-moz-calc(-2px)", + "-moz-calc(0)", + "-moz-calc(0pt)", + "-moz-calc(5em)", + "-moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 5em)", + "-moz-min(3em, 30em,200px, min(500px ,40em))", + ], invalid_values: [ "3%", "-1px" ] }, "-moz-column-rule": { @@ -2076,8 +2086,18 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "outline-style": "solid" }, - initial_values: [ "medium", "3px" ], - other_values: [ "thin", "thick", "1px", "2em" ], + initial_values: [ "medium", "3px", "-moz-calc(4px - 1px)" ], + other_values: [ "thin", "thick", "1px", "2em", + "-moz-calc(2px)", + "-moz-calc(-2px)", + "-moz-calc(0)", + "-moz-calc(0px)", + "-moz-calc(5em)", + "-moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 5em)", + "-moz-min(3em, 30em,200px, min(500px ,40em))", + ], invalid_values: [ "5%" ] }, "overflow": { From e82fb6cb2fee0862558a2b2f3334173e329c5acd Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:46 -0700 Subject: [PATCH 054/176] Fix missing computation half of calc() for border-*-width. (Bug 363249) r=bzbarsky a2.0=blocking2.0:beta6 --- layout/style/nsRuleNode.cpp | 6 +- layout/style/test/property_database.js | 92 +++++++++++++++++++++----- 2 files changed, 80 insertions(+), 18 deletions(-) diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index dc5ea149e480..daad875e9f63 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -5026,10 +5026,12 @@ nsRuleNode::ComputeBorderData(void* aStartStruct, (mPresContext->GetBorderWidthTable())[value.GetIntValue()]); } // OK to pass bad aParentCoord since we're not passing SETCOORD_INHERIT - else if (SetCoord(value, coord, nsStyleCoord(), SETCOORD_LENGTH, + else if (SetCoord(value, coord, nsStyleCoord(), + SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY, aContext, mPresContext, canStoreInRuleTree)) { NS_ASSERTION(coord.GetUnit() == eStyleUnit_Coord, "unexpected unit"); - border->SetBorderWidth(side, coord.GetCoordValue()); + // clamp negative calc() to 0. + border->SetBorderWidth(side, NS_MAX(coord.GetCoordValue(), 0)); } else if (eCSSUnit_Inherit == value.GetUnit()) { canStoreInRuleTree = PR_FALSE; diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 54b8c625ae94..e89960837ee7 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -129,8 +129,18 @@ var gCSSProperties = { type: CSS_TYPE_SHORTHAND_AND_LONGHAND, get_computed: logical_box_prop_get_computed, prerequisites: { "-moz-border-end-style": "solid" }, - initial_values: [ "medium", "3px" ], - other_values: [ "thin", "thick", "1px", "2em" ], + initial_values: [ "medium", "3px", "-moz-calc(4px - 1px)" ], + other_values: [ "thin", "thick", "1px", "2em", + "-moz-calc(2px)", + "-moz-calc(-2px)", + "-moz-calc(0em)", + "-moz-calc(0)", + "-moz-calc(5em)", + "-moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 5em)", + "-moz-min(3em, 30em,200px, min(500px ,40em))", + ], invalid_values: [ "5%" ] }, "-moz-border-image": { @@ -303,8 +313,18 @@ var gCSSProperties = { type: CSS_TYPE_SHORTHAND_AND_LONGHAND, get_computed: logical_box_prop_get_computed, prerequisites: { "-moz-border-start-style": "solid" }, - initial_values: [ "medium", "3px" ], - other_values: [ "thin", "thick", "1px", "2em" ], + initial_values: [ "medium", "3px", "-moz-calc(4px - 1px)" ], + other_values: [ "thin", "thick", "1px", "2em", + "-moz-calc(2px)", + "-moz-calc(-2px)", + "-moz-calc(0em)", + "-moz-calc(0)", + "-moz-calc(5em)", + "-moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 5em)", + "-moz-min(3em, 30em,200px, min(500px ,40em))", + ], invalid_values: [ "5%" ] }, "-moz-border-top-colors": { @@ -1286,8 +1306,8 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_TRUE_SHORTHAND, subproperties: [ "border-bottom-color", "border-bottom-style", "border-bottom-width", "border-left-color", "border-left-style", "border-left-width", "border-right-color", "border-right-style", "border-right-width", "border-top-color", "border-top-style", "border-top-width", "-moz-border-top-colors", "-moz-border-right-colors", "-moz-border-bottom-colors", "-moz-border-left-colors", "-moz-border-image" ], - initial_values: [ "none", "medium", "currentColor", "thin", "none medium currentcolor" ], - other_values: [ "solid", "medium solid", "green solid", "10px solid", "thick solid" ], + initial_values: [ "none", "medium", "currentColor", "thin", "none medium currentcolor", "-moz-calc(4px - 1px) none" ], + other_values: [ "solid", "medium solid", "green solid", "10px solid", "thick solid", "-moz-calc(2px) solid blue" ], invalid_values: [ "5%" ] }, "border-bottom": { @@ -1322,8 +1342,18 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "border-bottom-style": "solid" }, - initial_values: [ "medium", "3px" ], - other_values: [ "thin", "thick", "1px", "2em" ], + initial_values: [ "medium", "3px", "-moz-calc(4px - 1px)" ], + other_values: [ "thin", "thick", "1px", "2em", + "-moz-calc(2px)", + "-moz-calc(-2px)", + "-moz-calc(0em)", + "-moz-calc(0)", + "-moz-calc(5em)", + "-moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 5em)", + "-moz-min(3em, 30em,200px, min(500px ,40em))", + ], invalid_values: [ "5%" ] }, "border-collapse": { @@ -1375,8 +1405,18 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_SHORTHAND_AND_LONGHAND, prerequisites: { "border-left-style": "solid" }, - initial_values: [ "medium", "3px" ], - other_values: [ "thin", "thick", "1px", "2em" ], + initial_values: [ "medium", "3px", "-moz-calc(4px - 1px)" ], + other_values: [ "thin", "thick", "1px", "2em", + "-moz-calc(2px)", + "-moz-calc(-2px)", + "-moz-calc(0em)", + "-moz-calc(0)", + "-moz-calc(5em)", + "-moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 5em)", + "-moz-min(3em, 30em,200px, min(500px ,40em))", + ], invalid_values: [ "5%" ] }, "border-right": { @@ -1411,8 +1451,18 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_SHORTHAND_AND_LONGHAND, prerequisites: { "border-right-style": "solid" }, - initial_values: [ "medium", "3px" ], - other_values: [ "thin", "thick", "1px", "2em" ], + initial_values: [ "medium", "3px", "-moz-calc(4px - 1px)" ], + other_values: [ "thin", "thick", "1px", "2em", + "-moz-calc(2px)", + "-moz-calc(-2px)", + "-moz-calc(0em)", + "-moz-calc(0)", + "-moz-calc(5em)", + "-moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 5em)", + "-moz-min(3em, 30em,200px, min(500px ,40em))", + ], invalid_values: [ "5%" ] }, "border-spacing": { @@ -1465,8 +1515,18 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, prerequisites: { "border-top-style": "solid" }, - initial_values: [ "medium", "3px" ], - other_values: [ "thin", "thick", "1px", "2em" ], + initial_values: [ "medium", "3px", "-moz-calc(4px - 1px)" ], + other_values: [ "thin", "thick", "1px", "2em", + "-moz-calc(2px)", + "-moz-calc(-2px)", + "-moz-calc(0em)", + "-moz-calc(0)", + "-moz-calc(5em)", + "-moz-calc(3*25px)", + "-moz-calc(25px*3)", + "-moz-calc(3*25px + 5em)", + "-moz-min(3em, 30em,200px, min(500px ,40em))", + ], invalid_values: [ "5%" ] }, "border-width": { @@ -1475,8 +1535,8 @@ var gCSSProperties = { type: CSS_TYPE_TRUE_SHORTHAND, subproperties: [ "border-top-width", "border-right-width", "border-bottom-width", "border-left-width" ], prerequisites: { "border-style": "solid" }, - initial_values: [ "medium", "3px", "medium medium", "3px medium medium", "medium 3px medium medium" ], - other_values: [ "thin", "thick", "1px", "2em", "2px 0 0px 1em" ], + initial_values: [ "medium", "3px", "medium medium", "3px medium medium", "medium 3px medium medium", "-moz-calc(3px) 3px -moz-calc(5px - 2px) -moz-calc(2px - -1px)" ], + other_values: [ "thin", "thick", "1px", "2em", "2px 0 0px 1em", "-moz-calc(2em)" ], invalid_values: [ "5%" ] }, "bottom": { From 9ca64d59053527ba2f5382be6c91073b5e328e52 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:46 -0700 Subject: [PATCH 055/176] Add an invalid-value test for text-shadow that we already have for -moz-box-shadow. a2.0=tests --- layout/style/test/property_database.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index e89960837ee7..1847234b0648 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -2522,7 +2522,7 @@ var gCSSProperties = { "-moz-calc(2px) -moz-calc(2px)", "-moz-calc(2px) -moz-calc(2px) -moz-calc(2px)", ], - invalid_values: [ "3% 3%", "2px 2px 2px 2px", "2px 2px, none", "none, 2px 2px", "inherit, 2px 2px", "2px 2px, inherit", + invalid_values: [ "3% 3%", "2px 2px -5px", "2px 2px 2px 2px", "2px 2px, none", "none, 2px 2px", "inherit, 2px 2px", "2px 2px, inherit", "-moz-calc(2px) -moz-calc(2px) -moz-calc(2px) -moz-calc(2px)" ] }, From f54df514f78c4c3b9ddfbcc76695f9ad6a44b6a1 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:46 -0700 Subject: [PATCH 056/176] Add wctype.h to config/system-headers. (Bug 594492) r=cjones a2.0=bustage --- config/system-headers | 1 + js/src/config/system-headers | 1 + 2 files changed, 2 insertions(+) diff --git a/config/system-headers b/config/system-headers index 285384c1b283..437845d30970 100644 --- a/config/system-headers +++ b/config/system-headers @@ -861,6 +861,7 @@ Volume.h wab.h wait.h wchar.h +wctype.h winbase.h win/compobj.h windef.h diff --git a/js/src/config/system-headers b/js/src/config/system-headers index 285384c1b283..437845d30970 100644 --- a/js/src/config/system-headers +++ b/js/src/config/system-headers @@ -861,6 +861,7 @@ Volume.h wab.h wait.h wchar.h +wctype.h winbase.h win/compobj.h windef.h From 476ac2cf3432272f24faac654b183c8d08b7e10a Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:46 -0700 Subject: [PATCH 057/176] Remove unneeded nsDisplayClip::mClippingFrame. (Bug 459144, patch 11) r=roc a2.0=blocking2.0:beta6 --- layout/base/nsDisplayList.cpp | 16 ++++++++-------- layout/base/nsDisplayList.h | 12 ++---------- layout/base/nsPresShell.cpp | 2 +- layout/generic/nsFrame.cpp | 8 ++++---- layout/generic/nsSubDocumentFrame.cpp | 2 +- 5 files changed, 16 insertions(+), 24 deletions(-) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 6000d8e6d4c2..856fee09f20b 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -1287,18 +1287,18 @@ nsDisplayOwnLayer::BuildLayer(nsDisplayListBuilder* aBuilder, } nsDisplayClip::nsDisplayClip(nsDisplayListBuilder* aBuilder, - nsIFrame* aFrame, nsIFrame* aClippingFrame, - nsDisplayItem* aItem, const nsRect& aRect) + nsIFrame* aFrame, nsDisplayItem* aItem, + const nsRect& aRect) : nsDisplayWrapList(aBuilder, aFrame, aItem), - mClippingFrame(aClippingFrame), mClip(aRect) { + mClip(aRect) { MOZ_COUNT_CTOR(nsDisplayClip); } nsDisplayClip::nsDisplayClip(nsDisplayListBuilder* aBuilder, - nsIFrame* aFrame, nsIFrame* aClippingFrame, - nsDisplayList* aList, const nsRect& aRect) + nsIFrame* aFrame, nsDisplayList* aList, + const nsRect& aRect) : nsDisplayWrapList(aBuilder, aFrame, aList), - mClippingFrame(aClippingFrame), mClip(aRect) { + mClip(aRect) { MOZ_COUNT_CTOR(nsDisplayClip); } @@ -1340,7 +1340,7 @@ PRBool nsDisplayClip::TryMerge(nsDisplayListBuilder* aBuilder, if (aItem->GetType() != TYPE_CLIP) return PR_FALSE; nsDisplayClip* other = static_cast(aItem); - if (other->mClip != mClip || other->mClippingFrame != mClippingFrame) + if (other->mClip != mClip) return PR_FALSE; mList.AppendToBottom(&other->mList); return PR_TRUE; @@ -1349,7 +1349,7 @@ PRBool nsDisplayClip::TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayWrapList* nsDisplayClip::WrapWithClone(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) { return new (aBuilder) - nsDisplayClip(aBuilder, aItem->GetUnderlyingFrame(), mClippingFrame, aItem, mClip); + nsDisplayClip(aBuilder, aItem->GetUnderlyingFrame(), aItem, mClip); } nsDisplayZoom::nsDisplayZoom(nsDisplayListBuilder* aBuilder, diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index ecd39c851291..978c70eac173 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -1577,14 +1577,12 @@ class nsDisplayClip : public nsDisplayWrapList { public: /** * @param aFrame the frame that should be considered the underlying - * frame for this content, e.g. the frame whose z-index we have. - * @param aClippingFrame the frame that is inducing the clipping. + * frame for this content, e.g. the frame whose z-index we have. This + * is *not* the frame that is inducing the clipping. */ nsDisplayClip(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - nsIFrame* aClippingFrame, nsDisplayItem* aItem, const nsRect& aRect); nsDisplayClip(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - nsIFrame* aClippingFrame, nsDisplayList* aList, const nsRect& aRect); #ifdef NS_BUILD_REFCNT_LOGGING virtual ~nsDisplayClip(); @@ -1600,17 +1598,11 @@ public: const nsRect& GetClipRect() { return mClip; } void SetClipRect(const nsRect& aRect) { mClip = aRect; } - nsIFrame* GetClippingFrame() { return mClippingFrame; } virtual nsDisplayWrapList* WrapWithClone(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem); private: - // The frame that is responsible for the clipping. This may be different - // from mFrame because mFrame represents the content that is being - // clipped, and for example may be used to obtain the z-index of the - // content. - nsIFrame* mClippingFrame; nsRect mClip; }; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 86f6bbd6a545..a6ac3a1f14af 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5377,7 +5377,7 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder, // the selection. If the allocation fails, fall through and delete // the item below. itemToInsert = new (aBuilder) - nsDisplayClip(aBuilder, frame, frame, i, textRect); + nsDisplayClip(aBuilder, frame, i, textRect); } } // Don't try to descend into subdocuments. diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 22fe1a7d6a6b..f06e289b7407 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1259,13 +1259,13 @@ public: // We are not a stacking context root. There is no valid underlying // frame for the whole list. These items are all in-flow descendants so // we can safely just clip them. - return new (aBuilder) nsDisplayClip(aBuilder, nsnull, mContainer, aList, mRect); + return new (aBuilder) nsDisplayClip(aBuilder, nsnull, aList, mRect); } virtual nsDisplayItem* WrapItem(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) { nsIFrame* f = aItem->GetUnderlyingFrame(); if (mClipAll || nsLayoutUtils::IsProperAncestorFrame(mContainer, f, nsnull)) - return new (aBuilder) nsDisplayClip(aBuilder, f, mContainer, aItem, mRect); + return new (aBuilder) nsDisplayClip(aBuilder, f, aItem, mRect); return aItem; } protected: @@ -1284,12 +1284,12 @@ public: nsIFrame* aFrame, nsDisplayList* aList) { // We are not a stacking context root. There is no valid underlying // frame for the whole list. - return new (aBuilder) nsDisplayClip(aBuilder, nsnull, mContainer, aList, mRect); + return new (aBuilder) nsDisplayClip(aBuilder, nsnull, aList, mRect); } virtual nsDisplayItem* WrapItem(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) { return new (aBuilder) nsDisplayClip(aBuilder, aItem->GetUnderlyingFrame(), - mContainer, aItem, mRect); + aItem, mRect); } protected: nsIFrame* mContainer; diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index 657307c779aa..a0701f1a78b0 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -376,7 +376,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, // Clip children to the child root frame's rectangle rv = aLists.Content()->AppendNewToTop( - new (aBuilder) nsDisplayClip(aBuilder, this, this, &childItems, + new (aBuilder) nsDisplayClip(aBuilder, this, &childItems, subdocBoundsInParentUnits)); } // delete childItems in case of OOM From 9eb3bf0d246458f0e92c3f61b7ee56fb1a21fc6e Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:46 -0700 Subject: [PATCH 058/176] Remove unneeded nsAbsPosClipWrapper::mContainer. (Bug 459144, patch 12) r=roc a2.0=blocking2.0:beta6 --- layout/generic/nsFrame.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index f06e289b7407..15f9b7a66f61 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1278,8 +1278,8 @@ protected: class nsAbsPosClipWrapper : public nsDisplayWrapper { public: - nsAbsPosClipWrapper(nsIFrame* aContainer, const nsRect& aRect) - : mContainer(aContainer), mRect(aRect) {} + nsAbsPosClipWrapper(const nsRect& aRect) + : mRect(aRect) {} virtual nsDisplayItem* WrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList) { // We are not a stacking context root. There is no valid underlying @@ -1292,7 +1292,6 @@ public: aItem, mRect); } protected: - nsIFrame* mContainer; nsRect mRect; }; @@ -1481,7 +1480,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, resultList.AppendToTop(set.PositionedDescendants()); if (applyAbsPosClipping) { - nsAbsPosClipWrapper wrapper(this, absPosClip); + nsAbsPosClipWrapper wrapper(absPosClip); nsDisplayItem* item = wrapper.WrapList(aBuilder, this, &resultList); if (!item) return NS_ERROR_OUT_OF_MEMORY; @@ -1705,7 +1704,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, if (NS_SUCCEEDED(rv)) { if (isPositioned && applyAbsPosClipping) { - nsAbsPosClipWrapper wrapper(aChild, clipRect); + nsAbsPosClipWrapper wrapper(clipRect); rv = wrapper.WrapListsInPlace(aBuilder, aChild, pseudoStack); } } From 977bd2e2c8131b0d43516e5f52474f2d96a76dad Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:46 -0700 Subject: [PATCH 059/176] Make nsIFrame::DisplaySelectionOverlay take an nsDisplayList* instead of nsDisplayListSet&. (Bug 485501) r=roc a2.0=blocking:beta6 --- layout/forms/nsComboboxControlFrame.cpp | 2 +- layout/forms/nsFileControlFrame.cpp | 2 +- layout/forms/nsHTMLButtonControlFrame.cpp | 2 +- layout/generic/nsFrame.cpp | 4 ++-- layout/generic/nsFrame.h | 2 +- layout/generic/nsHTMLCanvasFrame.cpp | 2 +- layout/generic/nsImageFrame.cpp | 2 +- layout/generic/nsInlineFrame.cpp | 2 +- layout/xul/base/src/nsBoxFrame.cpp | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index cd77f7c7e52c..5c4f15c659ad 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -1375,7 +1375,7 @@ nsComboboxControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, } } - return DisplaySelectionOverlay(aBuilder, aLists); + return DisplaySelectionOverlay(aBuilder, aLists.Content()); } void nsComboboxControlFrame::PaintFocus(nsIRenderingContext& aRenderingContext, diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index 2e08cf8f9041..070876cddf99 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -686,7 +686,7 @@ nsFileControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, return rv; } - return DisplaySelectionOverlay(aBuilder, aLists); + return DisplaySelectionOverlay(aBuilder, aLists.Content()); } #ifdef ACCESSIBILITY diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index cd41c5c998c2..c9bb767f9cf5 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -193,7 +193,7 @@ nsHTMLButtonControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, NS_ENSURE_SUCCESS(rv, rv); // to draw border when selected in editor - return DisplaySelectionOverlay(aBuilder, aLists); + return DisplaySelectionOverlay(aBuilder, aLists.Content()); } nscoord diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 15f9b7a66f61..6531c16e7688 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1011,7 +1011,7 @@ void nsDisplaySelectionOverlay::Paint(nsDisplayListBuilder* aBuilder, nsresult nsFrame::DisplaySelectionOverlay(nsDisplayListBuilder* aBuilder, - const nsDisplayListSet& aLists, + nsDisplayList* aList, PRUint16 aContentType) { //check frame selection state @@ -1058,7 +1058,7 @@ nsFrame::DisplaySelectionOverlay(nsDisplayListBuilder* aBuilder, details = next; } - return aLists.Content()->AppendNewToTop(new (aBuilder) + return aList->AppendNewToTop(new (aBuilder) nsDisplaySelectionOverlay(aBuilder, this, selectionValue)); } diff --git a/layout/generic/nsFrame.h b/layout/generic/nsFrame.h index 1d4f222b57ef..4e933158bbf8 100644 --- a/layout/generic/nsFrame.h +++ b/layout/generic/nsFrame.h @@ -549,7 +549,7 @@ protected: * which kind of content this is for */ nsresult DisplaySelectionOverlay(nsDisplayListBuilder* aBuilder, - const nsDisplayListSet& aLists, PRUint16 aContentType = nsISelectionDisplay::DISPLAY_FRAMES); + nsDisplayList* aList, PRUint16 aContentType = nsISelectionDisplay::DISPLAY_FRAMES); PRInt16 DisplaySelection(nsPresContext* aPresContext, PRBool isOkToTurnOn = PR_FALSE); diff --git a/layout/generic/nsHTMLCanvasFrame.cpp b/layout/generic/nsHTMLCanvasFrame.cpp index 2ae0b72ebe9d..a7c876e65259 100644 --- a/layout/generic/nsHTMLCanvasFrame.cpp +++ b/layout/generic/nsHTMLCanvasFrame.cpp @@ -287,7 +287,7 @@ nsHTMLCanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, new (aBuilder) nsDisplayCanvas(aBuilder, this)); NS_ENSURE_SUCCESS(rv, rv); - return DisplaySelectionOverlay(aBuilder, aLists, + return DisplaySelectionOverlay(aBuilder, aLists.Content(), nsISelectionDisplay::DISPLAY_IMAGES); } diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 34a90e4f7ab1..715c25417352 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1357,7 +1357,7 @@ nsImageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, } #endif - return DisplaySelectionOverlay(aBuilder, aLists, + return DisplaySelectionOverlay(aBuilder, aLists.Content(), nsISelectionDisplay::DISPLAY_IMAGES); } diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp index f4e603550a1c..c0e4d05ad769 100644 --- a/layout/generic/nsInlineFrame.cpp +++ b/layout/generic/nsInlineFrame.cpp @@ -194,7 +194,7 @@ nsInlineFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, // normally don't have any size, but in Editor we use CSS to display // an image to represent this "hidden" element. if (!mFrames.FirstChild()) { - rv = DisplaySelectionOverlay(aBuilder, aLists); + rv = DisplaySelectionOverlay(aBuilder, aLists.Content()); } return rv; } diff --git a/layout/xul/base/src/nsBoxFrame.cpp b/layout/xul/base/src/nsBoxFrame.cpp index 2c3bfb67f605..8b89a492583f 100644 --- a/layout/xul/base/src/nsBoxFrame.cpp +++ b/layout/xul/base/src/nsBoxFrame.cpp @@ -1334,7 +1334,7 @@ nsBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, NS_ENSURE_SUCCESS(rv, rv); // see if we have to draw a selection frame around this container - rv = DisplaySelectionOverlay(aBuilder, destination); + rv = DisplaySelectionOverlay(aBuilder, destination.Content()); NS_ENSURE_SUCCESS(rv, rv); if (forceLayer) { From dd64617da39a568b6ae7d87e86e97e97067c05a5 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:46 -0700 Subject: [PATCH 060/176] Add a (wrapping) display item that clips its contents to the curvature of a border-radius. (Bug 459144, patch 13) r=roc a2.0=blocking2.0:beta6 --- layout/base/FrameLayerBuilder.cpp | 140 ++++++++++++++++++------- layout/base/FrameLayerBuilder.h | 62 +++++++++-- layout/base/crashtests/485501-1.html | 4 + layout/base/crashtests/crashtests.list | 1 + layout/base/nsDisplayItemTypes.h | 1 + layout/base/nsDisplayList.cpp | 73 +++++++++++++ layout/base/nsDisplayList.h | 46 +++++++- layout/base/nsLayoutDebugger.cpp | 3 +- layout/base/nsLayoutUtils.cpp | 4 +- 9 files changed, 284 insertions(+), 50 deletions(-) create mode 100644 layout/base/crashtests/485501-1.html diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index f0da64bc8dbe..81786e4bd5ac 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -43,6 +43,7 @@ #include "Layers.h" #include "BasicLayers.h" #include "nsSubDocumentFrame.h" +#include "nsCSSRendering.h" #ifdef DEBUG #include @@ -136,7 +137,7 @@ public: * if no clipping is required */ void ProcessDisplayItems(const nsDisplayList& aList, - const nsRect* aClipRect); + const FrameLayerBuilder::Clip& aClip); /** * This finalizes all the open ThebesLayers by popping every element off * mThebesLayerDataStack, then sets the children of the container layer @@ -1036,25 +1037,25 @@ BuildTempManagerForInactiveLayer(nsDisplayListBuilder* aBuilder, * We set the clip rect for items that generated their own layer. * (ThebesLayers don't need a clip rect on the layer, we clip the items * individually when we draw them.) + * If we have to clip to a rounded rect, we treat any active layer as + * though it's inactive so that we draw it ourselves into the thebes layer. * We set the visible rect for all layers, although the actual setting * of visible rects for some ThebesLayers is deferred until the calling * of ContainerState::Finish. */ void ContainerState::ProcessDisplayItems(const nsDisplayList& aList, - const nsRect* aClipRect) + const FrameLayerBuilder::Clip& aClip) { PRInt32 appUnitsPerDevPixel = mContainerFrame->PresContext()->AppUnitsPerDevPixel(); for (nsDisplayItem* item = aList.GetBottom(); item; item = item->GetAbove()) { - if (item->GetType() == nsDisplayItem::TYPE_CLIP) { - nsDisplayClip* clipItem = static_cast(item); - nsRect clip = clipItem->GetClipRect(); - if (aClipRect) { - clip.IntersectRect(clip, *aClipRect); - } - ProcessDisplayItems(*clipItem->GetList(), &clip); + nsDisplayItem::Type type = item->GetType(); + if (type == nsDisplayItem::TYPE_CLIP || + type == nsDisplayItem::TYPE_CLIP_ROUNDED_RECT) { + FrameLayerBuilder::Clip childClip(aClip, item); + ProcessDisplayItems(*item->GetList(), childClip); continue; } @@ -1064,15 +1065,15 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList, nsIntRect itemVisibleRect = item->GetVisibleRect().ToNearestPixels(appUnitsPerDevPixel); nsRect itemContent = item->GetBounds(mBuilder); - if (aClipRect) { - itemContent.IntersectRect(*aClipRect, itemContent); + if (aClip.mHaveClipRect) { + itemContent.IntersectRect(aClip.mClipRect, itemContent); } nsIntRect itemDrawRect = itemContent.ToNearestPixels(appUnitsPerDevPixel); nsDisplayItem::LayerState layerState = item->GetLayerState(mBuilder, mManager); // Assign the item to a layer - if (layerState == LAYER_ACTIVE) { + if (layerState == LAYER_ACTIVE && aClip.mRoundedClipRects.IsEmpty()) { // If the item would have its own layer but is invisible, just hide it. // Note that items without their own layers can't be skipped this // way, since their ThebesLayer may decide it wants to draw them @@ -1094,9 +1095,9 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList, NS_ASSERTION(!ownLayer->HasUserData(&gLayerManagerUserData), "We shouldn't have a FrameLayerBuilder-managed layer here!"); // It has its own layer. Update that layer's clip and visible rects. - if (aClipRect) { + if (aClip.mHaveClipRect) { ownLayer->IntersectClipRect( - aClipRect->ToNearestPixels(appUnitsPerDevPixel)); + aClip.mClipRect.ToNearestPixels(appUnitsPerDevPixel)); } ThebesLayerData* data = GetTopThebesLayerData(); if (data) { @@ -1121,7 +1122,7 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList, mBuilder->LayerBuilder()->AddLayerDisplayItem(ownLayer, item); } else { nsRefPtr tempLayerManager; - if (layerState == LAYER_INACTIVE) { + if (layerState != LAYER_NONE) { tempLayerManager = BuildTempManagerForInactiveLayer(mBuilder, item); if (!tempLayerManager) continue; @@ -1149,7 +1150,7 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList, InvalidateForLayerChange(item, thebesLayer); mBuilder->LayerBuilder()-> - AddThebesDisplayItem(thebesLayer, item, aClipRect, mContainerFrame, + AddThebesDisplayItem(thebesLayer, item, aClip, mContainerFrame, layerState, tempLayerManager); } } @@ -1201,7 +1202,7 @@ ContainerState::InvalidateForLayerChange(nsDisplayItem* aItem, Layer* aNewLayer) void FrameLayerBuilder::AddThebesDisplayItem(ThebesLayer* aLayer, nsDisplayItem* aItem, - const nsRect* aClipRect, + const Clip& aClip, nsIFrame* aContainerLayerFrame, LayerState aLayerState, LayerManager* aTempManager) @@ -1213,7 +1214,7 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayer* aLayer, entry->mContainerLayerFrame = aContainerLayerFrame; NS_ASSERTION(aItem->GetUnderlyingFrame(), "Must have frame"); ClippedDisplayItem* cdi = - entry->mItems.AppendElement(ClippedDisplayItem(aItem, aClipRect)); + entry->mItems.AppendElement(ClippedDisplayItem(aItem, aClip)); cdi->mTempLayerManager = aTempManager; } } @@ -1395,7 +1396,8 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder, SetHasContainerLayer(aContainerFrame); } - state.ProcessDisplayItems(aChildren, nsnull); + Clip clip; + state.ProcessDisplayItems(aChildren, clip); state.Finish(); PRUint32 flags = aChildren.IsOpaque() ? Layer::CONTENT_OPAQUE : 0; @@ -1597,7 +1599,13 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer, NS_ASSERTION(AppUnitsPerDevPixel(cdi->mItem) == appUnitsPerDevPixel, "a thebes layer should contain items only at the same zoom"); - if (!cdi->mHasClipRect || cdi->mClipRect.Contains(visible.GetBounds())) { + NS_ABORT_IF_FALSE(cdi->mClip.mHaveClipRect || + cdi->mClip.mRoundedClipRects.IsEmpty(), + "If we have rounded rects, we must have a clip rect"); + + if (!cdi->mClip.mHaveClipRect || + (cdi->mClip.mRoundedClipRects.IsEmpty() && + cdi->mClip.mClipRect.Contains(visible.GetBounds()))) { cdi->mItem->RecomputeVisibility(builder, &visible); continue; } @@ -1605,16 +1613,20 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer, // Do a little dance to account for the fact that we're clipping // to cdi->mClipRect nsRegion clipped; - clipped.And(visible, cdi->mClipRect); + clipped.And(visible, cdi->mClip.mClipRect); nsRegion finalClipped = clipped; cdi->mItem->RecomputeVisibility(builder, &finalClipped); - nsRegion removed; - removed.Sub(clipped, finalClipped); - nsRegion newVisible; - newVisible.Sub(visible, removed); - // Don't let the visible region get too complex. - if (newVisible.GetNumRects() <= 15) { - visible = newVisible; + // If we have rounded clip rects, don't subtract from the visible + // region since we aren't displaying everything inside the rect. + if (cdi->mClip.mRoundedClipRects.IsEmpty()) { + nsRegion removed; + removed.Sub(clipped, finalClipped); + nsRegion newVisible; + newVisible.Sub(visible, removed); + // Don't let the visible region get too complex. + if (newVisible.GetNumRects() <= 15) { + visible = newVisible; + } } } @@ -1625,7 +1637,7 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer, return; rc->Init(presContext->DeviceContext(), aContext); - nsRect currentClip; + Clip currentClip; PRBool setClipRect = PR_FALSE; for (i = 0; i < items.Length(); ++i) { @@ -1636,20 +1648,16 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer, // If the new desired clip state is different from the current state, // update the clip. - if (setClipRect != cdi->mHasClipRect || - (cdi->mHasClipRect && cdi->mClipRect != currentClip)) { + if (setClipRect != cdi->mClip.mHaveClipRect || + (cdi->mClip.mHaveClipRect && cdi->mClip != currentClip)) { if (setClipRect) { aContext->Restore(); } - setClipRect = cdi->mHasClipRect; + setClipRect = cdi->mClip.mHaveClipRect; if (setClipRect) { - currentClip = cdi->mClipRect; + currentClip = cdi->mClip; aContext->Save(); - aContext->NewPath(); - gfxRect clip(currentClip.x, currentClip.y, currentClip.width, currentClip.height); - clip.ScaleInverse(presContext->AppUnitsPerDevPixel()); - aContext->Rectangle(clip, PR_TRUE); - aContext->Clip(); + currentClip.ApplyTo(aContext, presContext); } } @@ -1678,4 +1686,60 @@ FrameLayerBuilder::DumpRetainedLayerTree() } #endif +FrameLayerBuilder::Clip::Clip(const Clip& aOther, nsDisplayItem* aClipItem) + : mRoundedClipRects(aOther.mRoundedClipRects), + mHaveClipRect(PR_TRUE) +{ + nsDisplayItem::Type type = aClipItem->GetType(); + NS_ABORT_IF_FALSE(type == nsDisplayItem::TYPE_CLIP || + type == nsDisplayItem::TYPE_CLIP_ROUNDED_RECT, + "unexpected display item type"); + nsDisplayClip* item = static_cast(aClipItem); + // Always intersect with mClipRect, even if we're going to add a + // rounded rect. + if (aOther.mHaveClipRect) { + mClipRect.IntersectRect(aOther.mClipRect, item->GetClipRect()); + } else { + mClipRect = item->GetClipRect(); + } + + if (type == nsDisplayItem::TYPE_CLIP_ROUNDED_RECT) { + RoundedRect *rr = mRoundedClipRects.AppendElement(); + if (rr) { + rr->mRect = item->GetClipRect(); + static_cast(item)->GetRadii(rr->mRadii); + } + } + + // FIXME: Optimize away excess rounded rectangles due to the new addition. +} + +void +FrameLayerBuilder::Clip::ApplyTo(gfxContext* aContext, + nsPresContext* aPresContext) +{ + aContext->NewPath(); + PRInt32 A2D = aPresContext->AppUnitsPerDevPixel(); + gfxRect clip = nsLayoutUtils::RectToGfxRect(mClipRect, A2D); + aContext->Rectangle(clip, PR_TRUE); + aContext->Clip(); + + for (PRUint32 i = 0, iEnd = mRoundedClipRects.Length(); + i < iEnd; ++i) { + const Clip::RoundedRect &rr = mRoundedClipRects[i]; + + gfxCornerSizes pixelRadii; + nsCSSRendering::ComputePixelRadii(rr.mRadii, A2D, &pixelRadii); + + clip = nsLayoutUtils::RectToGfxRect(rr.mRect, A2D); + clip.Round(); + clip.Condition(); + // REVIEW: This might make clip empty. Is that OK? + + aContext->NewPath(); + aContext->RoundedRectangle(clip, pixelRadii); + aContext->Clip(); + } +} + } // namespace mozilla diff --git a/layout/base/FrameLayerBuilder.h b/layout/base/FrameLayerBuilder.h index 4cce9ebbcb70..6524f87ce4a0 100644 --- a/layout/base/FrameLayerBuilder.h +++ b/layout/base/FrameLayerBuilder.h @@ -227,9 +227,10 @@ public: * for the container layer this ThebesItem belongs to. * aItem must have an underlying frame. */ + struct Clip; void AddThebesDisplayItem(ThebesLayer* aLayer, nsDisplayItem* aItem, - const nsRect* aClipRect, + const Clip& aClip, nsIFrame* aContainerLayerFrame, LayerState aLayerState, LayerManager* aTempManager); @@ -263,6 +264,55 @@ public: nscolor FindOpaqueColorCovering(nsDisplayListBuilder* aBuilder, ThebesLayer* aLayer, const nsRect& aRect); + /** + * Clip represents the intersection of an optional rectangle with a + * list of rounded rectangles. + */ + struct Clip { + struct RoundedRect { + nsRect mRect; + // Indices into mRadii are the NS_CORNER_* constants in nsStyleConsts.h + nscoord mRadii[8]; + + bool operator==(const RoundedRect& aOther) const { + if (mRect != aOther.mRect) { + return false; + } + + NS_FOR_CSS_HALF_CORNERS(corner) { + if (mRadii[corner] != aOther.mRadii[corner]) { + return false; + } + } + return true; + } + bool operator!=(const RoundedRect& aOther) const { + return !(*this == aOther); + } + }; + nsRect mClipRect; + nsTArray mRoundedClipRects; + PRPackedBool mHaveClipRect; + + Clip() : mHaveClipRect(PR_FALSE) {} + + // Construct as the intersection of aOther and aClipItem. + Clip(const Clip& aOther, nsDisplayItem* aClipItem); + + // Apply this |Clip| to the given gfxContext. Any saving of state + // or clearing of other clips must be done by the caller. + void ApplyTo(gfxContext* aContext, nsPresContext* aPresContext); + + bool operator==(const Clip& aOther) const { + return mHaveClipRect == aOther.mHaveClipRect && + (!mHaveClipRect || mClipRect == aOther.mClipRect) && + mRoundedClipRects == aOther.mRoundedClipRects; + } + bool operator!=(const Clip& aOther) const { + return !(*this == aOther); + } + }; + protected: /** * We store an array of these for each frame that is associated with @@ -323,18 +373,14 @@ protected: * mItem always has an underlying frame. */ struct ClippedDisplayItem { - ClippedDisplayItem(nsDisplayItem* aItem, const nsRect* aClipRect) - : mItem(aItem), mHasClipRect(aClipRect != nsnull) + ClippedDisplayItem(nsDisplayItem* aItem, const Clip& aClip) + : mItem(aItem), mClip(aClip) { - if (mHasClipRect) { - mClipRect = *aClipRect; - } } nsDisplayItem* mItem; nsRefPtr mTempLayerManager; - nsRect mClipRect; - PRPackedBool mHasClipRect; + Clip mClip; }; /** diff --git a/layout/base/crashtests/485501-1.html b/layout/base/crashtests/485501-1.html new file mode 100644 index 000000000000..072cdaa8708b --- /dev/null +++ b/layout/base/crashtests/485501-1.html @@ -0,0 +1,4 @@ + +
+ This is some text that should get clipped at the corners by the border radius. +
diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index 6d38fc04e3b1..8376203298ee 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -257,6 +257,7 @@ load 477333-1.xhtml load 477731-1.html load 481806-1.html load 483604-1.xhtml +load 485501-1.html load 487544-1.html load 488390-1.xhtml load 489691.html diff --git a/layout/base/nsDisplayItemTypes.h b/layout/base/nsDisplayItemTypes.h index 780237c24627..72081b9775d6 100644 --- a/layout/base/nsDisplayItemTypes.h +++ b/layout/base/nsDisplayItemTypes.h @@ -61,6 +61,7 @@ enum Type { TYPE_CHECKED_CHECKBOX, TYPE_CHECKED_RADIOBUTTON, TYPE_CLIP, + TYPE_CLIP_ROUNDED_RECT, TYPE_COLUMN_RULE, TYPE_COMBOBOX_FOCUS, TYPE_EVENT_RECEIVER, diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 856fee09f20b..aad682e70506 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -1352,6 +1352,79 @@ nsDisplayWrapList* nsDisplayClip::WrapWithClone(nsDisplayListBuilder* aBuilder, nsDisplayClip(aBuilder, aItem->GetUnderlyingFrame(), aItem, mClip); } +nsDisplayClipRoundedRect::nsDisplayClipRoundedRect( + nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, + nsDisplayItem* aItem, + const nsRect& aRect, nscoord aRadii[8]) + : nsDisplayClip(aBuilder, aFrame, aItem, aRect) +{ + MOZ_COUNT_CTOR(nsDisplayClipRoundedRect); + memcpy(mRadii, aRadii, sizeof(mRadii)); +} + +nsDisplayClipRoundedRect::nsDisplayClipRoundedRect( + nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, + nsDisplayList* aList, + const nsRect& aRect, nscoord aRadii[8]) + : nsDisplayClip(aBuilder, aFrame, aList, aRect) +{ + MOZ_COUNT_CTOR(nsDisplayClipRoundedRect); + memcpy(mRadii, aRadii, sizeof(mRadii)); +} + +#ifdef NS_BUILD_REFCNT_LOGGING +nsDisplayClipRoundedRect::~nsDisplayClipRoundedRect() +{ + MOZ_COUNT_DTOR(nsDisplayClipRoundedRect); +} +#endif + +PRBool nsDisplayClipRoundedRect::IsOpaque(nsDisplayListBuilder* aBuilder) +{ + return PR_FALSE; +} + +void +nsDisplayClipRoundedRect::HitTest(nsDisplayListBuilder* aBuilder, + const nsRect& aRect, HitTestState* aState, + nsTArray *aOutFrames) +{ + // FIXME: Consider border-radius. + mList.HitTest(aBuilder, aRect, aState, aOutFrames); +} + +nsDisplayWrapList* +nsDisplayClipRoundedRect::WrapWithClone(nsDisplayListBuilder* aBuilder, + nsDisplayItem* aItem) { + return new (aBuilder) + nsDisplayClipRoundedRect(aBuilder, aItem->GetUnderlyingFrame(), aItem, + mClip, mRadii); +} + +PRBool nsDisplayClipRoundedRect::ComputeVisibility( + nsDisplayListBuilder* aBuilder, + nsRegion* aVisibleRegion) +{ + nsRegion clipped; + clipped.And(*aVisibleRegion, mClip); + + return nsDisplayWrapList::ComputeVisibility(aBuilder, &clipped); + // FIXME: Remove a *conservative* opaque region from aVisibleRegion + // (like in nsDisplayClip::ComputeVisibility). +} + +PRBool nsDisplayClipRoundedRect::TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) +{ + if (aItem->GetType() != TYPE_CLIP_ROUNDED_RECT) + return PR_FALSE; + nsDisplayClipRoundedRect* other = + static_cast(aItem); + if (mClip != other->mClip || mRadii != other->mRadii) + return PR_FALSE; + mList.AppendToBottom(&other->mList); + return PR_TRUE; +} + nsDisplayZoom::nsDisplayZoom(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, PRInt32 aAPD, PRInt32 aParentAPD) diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 978c70eac173..da9c8175ba9d 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -479,7 +479,7 @@ public: * This will only return a zero value for items which wrap display lists * and do not create a CSS stacking context, therefore requiring * display items to be individually wrapped --- currently nsDisplayClip - * only. + * and nsDisplayClipRoundedRect only. */ virtual PRUint32 GetPerFrameKey() { return PRUint32(GetType()); } /** @@ -1307,6 +1307,7 @@ public: virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, HitTestState* aState, nsTArray *aOutFrames) { + // FIXME: Consider border-radius. aOutFrames->AppendElement(mFrame); } virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, @@ -1414,6 +1415,7 @@ public: virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, HitTestState* aState, nsTArray *aOutFrames) { + // FIXME: Consider border-radius. aOutFrames->AppendElement(mFrame); } NS_DISPLAY_DECL_NAME("EventReceiver", TYPE_EVENT_RECEIVER) @@ -1602,10 +1604,50 @@ public: virtual nsDisplayWrapList* WrapWithClone(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem); -private: +protected: nsRect mClip; }; +/** + * A display item to clip a list of items to the border-radius of a + * frame. + */ +class nsDisplayClipRoundedRect : public nsDisplayClip { +public: + /** + * @param aFrame the frame that should be considered the underlying + * frame for this content, e.g. the frame whose z-index we have. This + * is *not* the frame that is inducing the clipping. + */ + nsDisplayClipRoundedRect(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, + nsDisplayItem* aItem, + const nsRect& aRect, nscoord aRadii[8]); + nsDisplayClipRoundedRect(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, + nsDisplayList* aList, + const nsRect& aRect, nscoord aRadii[8]); +#ifdef NS_BUILD_REFCNT_LOGGING + virtual ~nsDisplayClipRoundedRect(); +#endif + + virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder); + virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, + HitTestState* aState, nsTArray *aOutFrames); + virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, + nsRegion* aVisibleRegion); + virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem); + NS_DISPLAY_DECL_NAME("ClipRoundedRect", TYPE_CLIP_ROUNDED_RECT) + + virtual nsDisplayWrapList* WrapWithClone(nsDisplayListBuilder* aBuilder, + nsDisplayItem* aItem); + + void GetRadii(nscoord aRadii[8]) { + memcpy(aRadii, mRadii, sizeof(mRadii)); + } + +private: + nscoord mRadii[8]; +}; + /** * nsDisplayZoom is used for subdocuments that have a different full zoom than * their parent documents. This item creates a container layer. diff --git a/layout/base/nsLayoutDebugger.cpp b/layout/base/nsLayoutDebugger.cpp index 60c1d8bf69c8..037974b7558d 100644 --- a/layout/base/nsLayoutDebugger.cpp +++ b/layout/base/nsLayoutDebugger.cpp @@ -166,7 +166,8 @@ PrintDisplayListTo(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList, } nsRect rect = i->GetBounds(aBuilder); switch (i->GetType()) { - case nsDisplayItem::TYPE_CLIP: { + case nsDisplayItem::TYPE_CLIP: + case nsDisplayItem::TYPE_CLIP_ROUNDED_RECT: { nsDisplayClip* c = static_cast(i); rect = c->GetClipRect(); break; diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index bffef0ddd22e..113b0b15e35c 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -1144,7 +1144,9 @@ PruneDisplayListForExtraPage(nsDisplayListBuilder* aBuilder, nsDisplayList* subList = i->GetList(); if (subList) { PruneDisplayListForExtraPage(aBuilder, aExtraPage, aY, subList); - if (i->GetType() == nsDisplayItem::TYPE_CLIP) { + nsDisplayItem::Type type = i->GetType(); + if (type == nsDisplayItem::TYPE_CLIP || + type == nsDisplayItem::TYPE_CLIP_ROUNDED_RECT) { // This might clip an element which should appear on the first // page, and that element might be visible if this uses a 'clip' // property with a negative top. From 58eb6a43d396c3ce6d0ba18e61033a71e12d8b96 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:46 -0700 Subject: [PATCH 061/176] Clip contents of elements with overflow != visible to the border radius. (Bug 459144, patch 14) r=roc a2.0=blocking2.0:beta6 --- layout/forms/nsFileControlFrame.cpp | 3 +- layout/forms/nsHTMLButtonControlFrame.cpp | 6 ++- layout/generic/nsFrame.cpp | 51 +++++++++++++++++++---- layout/generic/nsGfxScrollFrame.cpp | 7 +++- layout/generic/nsIFrame.h | 3 ++ 5 files changed, 57 insertions(+), 13 deletions(-) diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index 070876cddf99..197e41080e5a 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -672,7 +672,8 @@ nsFileControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, // Clip height only nsRect clipRect(aBuilder->ToReferenceFrame(this), GetSize()); clipRect.width = GetOverflowRect().XMost(); - rv = OverflowClip(aBuilder, tempList, aLists, clipRect); + nscoord radii[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + rv = OverflowClip(aBuilder, tempList, aLists, clipRect, radii); NS_ENSURE_SUCCESS(rv, rv); // Disabled file controls don't pass mouse events to their children, so we diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index c9bb767f9cf5..cc3f5e101f5d 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -182,8 +182,10 @@ nsHTMLButtonControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, nsMargin border = GetStyleBorder()->GetActualBorder(); nsRect rect(aBuilder->ToReferenceFrame(this), GetSize()); rect.Deflate(border); - - nsresult rv = OverflowClip(aBuilder, set, aLists, rect); + nscoord radii[8]; + GetPaddingBoxBorderRadii(radii); + + nsresult rv = OverflowClip(aBuilder, set, aLists, rect, radii); NS_ENSURE_SUCCESS(rv, rv); } else { set.MoveTo(aLists); diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 6531c16e7688..903da30c691e 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1250,29 +1250,52 @@ public: * which we aren't the containing block */ nsOverflowClipWrapper(nsIFrame* aContainer, const nsRect& aRect, + const nscoord aRadii[8], PRBool aClipBorderBackground, PRBool aClipAll) : mContainer(aContainer), mRect(aRect), - mClipBorderBackground(aClipBorderBackground), mClipAll(aClipAll) {} + mClipBorderBackground(aClipBorderBackground), mClipAll(aClipAll), + mHaveRadius(PR_FALSE) + { + memcpy(mRadii, aRadii, sizeof(mRadii)); + NS_FOR_CSS_HALF_CORNERS(corner) { + if (aRadii[corner] > 0) { + mHaveRadius = PR_TRUE; + break; + } + } + } virtual PRBool WrapBorderBackground() { return mClipBorderBackground; } virtual nsDisplayItem* WrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList) { // We are not a stacking context root. There is no valid underlying // frame for the whole list. These items are all in-flow descendants so // we can safely just clip them. + if (mHaveRadius) { + return new (aBuilder) nsDisplayClipRoundedRect(aBuilder, nsnull, aList, + mRect, mRadii); + } return new (aBuilder) nsDisplayClip(aBuilder, nsnull, aList, mRect); } virtual nsDisplayItem* WrapItem(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) { nsIFrame* f = aItem->GetUnderlyingFrame(); - if (mClipAll || nsLayoutUtils::IsProperAncestorFrame(mContainer, f, nsnull)) + if (mClipAll || + nsLayoutUtils::IsProperAncestorFrame(mContainer, f, nsnull)) { + if (mHaveRadius) { + return new (aBuilder) nsDisplayClipRoundedRect(aBuilder, f, aItem, + mRect, mRadii); + } return new (aBuilder) nsDisplayClip(aBuilder, f, aItem, mRect); + } return aItem; } protected: nsIFrame* mContainer; nsRect mRect; + nscoord mRadii[8]; PRPackedBool mClipBorderBackground; PRPackedBool mClipAll; + PRPackedBool mHaveRadius; }; class nsAbsPosClipWrapper : public nsDisplayWrapper @@ -1300,25 +1323,27 @@ nsIFrame::OverflowClip(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aFromSet, const nsDisplayListSet& aToSet, const nsRect& aClipRect, + const nscoord aClipRadii[8], PRBool aClipBorderBackground, PRBool aClipAll) { - nsOverflowClipWrapper wrapper(this, aClipRect, aClipBorderBackground, aClipAll); + nsOverflowClipWrapper wrapper(this, aClipRect, aClipRadii, + aClipBorderBackground, aClipAll); return wrapper.WrapLists(aBuilder, this, aFromSet, aToSet); } static nsresult BuildDisplayListWithOverflowClip(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, const nsRect& aDirtyRect, const nsDisplayListSet& aSet, - const nsRect& aClipRect) + const nsRect& aClipRect, const nscoord aClipRadii[8]) { nsDisplayListCollection set; nsresult rv = aFrame->BuildDisplayList(aBuilder, aDirtyRect, set); NS_ENSURE_SUCCESS(rv, rv); rv = aBuilder->DisplayCaret(aFrame, aDirtyRect, aSet.Content()); NS_ENSURE_SUCCESS(rv, rv); - - return aFrame->OverflowClip(aBuilder, set, aSet, aClipRect); + + return aFrame->OverflowClip(aBuilder, set, aSet, aClipRect, aClipRadii); } #ifdef NS_DEBUG @@ -1434,7 +1459,10 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, nsRect overflowClip; if (ApplyOverflowClipping(aBuilder, this, disp, &overflowClip)) { - nsOverflowClipWrapper wrapper(this, overflowClip, PR_FALSE, PR_FALSE); + nscoord radii[8]; + this->GetPaddingBoxBorderRadii(radii); + nsOverflowClipWrapper wrapper(this, overflowClip, radii, + PR_FALSE, PR_FALSE); rv = wrapper.WrapListsInPlace(aBuilder, this, set); NS_ENSURE_SUCCESS(rv, rv); } @@ -1635,8 +1663,12 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, } nsRect overflowClip; + nscoord overflowClipRadii[8]; PRBool applyOverflowClip = ApplyOverflowClipping(aBuilder, aChild, disp, &overflowClip); + if (applyOverflowClip) { + aChild->GetPaddingBoxBorderRadii(overflowClipRadii); + } // Don't use overflowClip to restrict the dirty rect, since some of the // descendants may not be clipped by it. Even if we end up with unnecessary // display items, they'll be pruned during ComputeVisibility. Note that @@ -1652,7 +1684,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, // return early. if (applyOverflowClip) { rv = BuildDisplayListWithOverflowClip(aBuilder, aChild, dirty, aLists, - overflowClip); + overflowClip, overflowClipRadii); } else { rv = aChild->BuildDisplayList(aBuilder, dirty, aLists); if (NS_SUCCEEDED(rv)) { @@ -1694,7 +1726,8 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, if (applyOverflowClip) { rv = BuildDisplayListWithOverflowClip(aBuilder, aChild, clippedDirtyRect, - pseudoStack, overflowClip); + pseudoStack, overflowClip, + overflowClipRadii); } else { rv = aChild->BuildDisplayList(aBuilder, clippedDirtyRect, pseudoStack); if (NS_SUCCEEDED(rv)) { diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 4b3b6b52576f..5fdc3cff3ba9 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -1788,12 +1788,17 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder, rv = mOuter->BuildDisplayListForChild(aBuilder, mScrolledFrame, dirtyRect, set); NS_ENSURE_SUCCESS(rv, rv); nsRect clip = mScrollPort + aBuilder->ToReferenceFrame(mOuter); + nscoord radii[8]; + // Our override of GetBorderRadii ensures we never have a radius at + // the corners where we have a scrollbar. + mOuter->GetPaddingBoxBorderRadii(radii); // mScrolledFrame may have given us a background, e.g., the scrolled canvas // frame below the viewport. If so, we want it to be clipped. We also want // to end up on our BorderBackground list. // If we are the viewport scrollframe, then clip all our descendants (to ensure // that fixed-pos elements get clipped by us). - rv = mOuter->OverflowClip(aBuilder, set, aLists, clip, PR_TRUE, mIsRoot); + rv = mOuter->OverflowClip(aBuilder, set, aLists, clip, radii, + PR_TRUE, mIsRoot); NS_ENSURE_SUCCESS(rv, rv); // Place the resizer in the display list in our Content() list above diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index b2cea982e95a..014f22bba58a 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -1097,11 +1097,14 @@ public: * border/background/outline items for this frame are not clipped, * unless aClipBorderBackground is set to PR_TRUE. (We need this because * a scrollframe must overflow-clip its scrolled child's background/borders.) + * + * Indices into aClipRadii are the NS_CORNER_* constants in nsStyleConsts.h */ nsresult OverflowClip(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aFromSet, const nsDisplayListSet& aToSet, const nsRect& aClipRect, + const nscoord aClipRadii[8], PRBool aClipBorderBackground = PR_FALSE, PRBool aClipAll = PR_FALSE); From c44e387e0444409ea60b7f95859482ffc897d464 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:47 -0700 Subject: [PATCH 062/176] Clip replaced elements (for now, images, canvases, videos, and windowless plugins) to the border radius. (Bug 485501) r=roc a2.0=blocking:beta6 --- layout/generic/nsFrame.cpp | 21 +++++++++++++++++++++ layout/generic/nsHTMLCanvasFrame.cpp | 13 ++++++++++--- layout/generic/nsIFrame.h | 9 +++++++++ layout/generic/nsImageFrame.cpp | 16 +++++++++++----- layout/generic/nsObjectFrame.cpp | 18 +++++++++++++----- layout/generic/nsVideoFrame.cpp | 11 ++++++++--- 6 files changed, 72 insertions(+), 16 deletions(-) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 903da30c691e..9640b3f5cd7c 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1776,6 +1776,27 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, return NS_OK; } +void +nsIFrame::WrapReplacedContentForBorderRadius(nsDisplayListBuilder* aBuilder, + nsDisplayList* aFromList, + const nsDisplayListSet& aToLists) +{ + nscoord radii[8]; + if (GetContentBoxBorderRadii(radii)) { + // If we have a border-radius, we have to clip our content to that + // radius. + nsDisplayListCollection set; + set.Content()->AppendToTop(aFromList); + nsRect clipRect = GetContentRect() - GetPosition() + + aBuilder->ToReferenceFrame(this); + OverflowClip(aBuilder, set, aToLists, clipRect, radii, PR_FALSE, PR_TRUE); + + return; + } + + aToLists.Content()->AppendToTop(aFromList); +} + NS_IMETHODIMP nsFrame::GetContentForEvent(nsPresContext* aPresContext, nsEvent* aEvent, diff --git a/layout/generic/nsHTMLCanvasFrame.cpp b/layout/generic/nsHTMLCanvasFrame.cpp index a7c876e65259..b68320e7453e 100644 --- a/layout/generic/nsHTMLCanvasFrame.cpp +++ b/layout/generic/nsHTMLCanvasFrame.cpp @@ -283,12 +283,19 @@ nsHTMLCanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, nsresult rv = DisplayBorderBackgroundOutline(aBuilder, aLists); NS_ENSURE_SUCCESS(rv, rv); - rv = aLists.Content()->AppendNewToTop( + nsDisplayList replacedContent; + + rv = replacedContent.AppendNewToTop( new (aBuilder) nsDisplayCanvas(aBuilder, this)); NS_ENSURE_SUCCESS(rv, rv); - return DisplaySelectionOverlay(aBuilder, aLists.Content(), - nsISelectionDisplay::DISPLAY_IMAGES); + rv = DisplaySelectionOverlay(aBuilder, &replacedContent, + nsISelectionDisplay::DISPLAY_IMAGES); + NS_ENSURE_SUCCESS(rv, rv); + + WrapReplacedContentForBorderRadius(aBuilder, &replacedContent, aLists); + + return NS_OK; } nsIAtom* diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 014f22bba58a..ec730bbbc566 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -1128,6 +1128,15 @@ public: const nsDisplayListSet& aLists, PRUint32 aFlags = 0); + /** + * A helper for replaced elements that want to clip their content to a + * border radius, but only need clipping at all when they have a + * border radius. + */ + void WrapReplacedContentForBorderRadius(nsDisplayListBuilder* aBuilder, + nsDisplayList* aFromList, + const nsDisplayListSet& aToLists); + /** * Does this frame need a view? */ diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 715c25417352..d2074d90de8d 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1243,7 +1243,8 @@ nsImageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, // REVIEW: Checking mRect.IsEmpty() makes no sense to me, so I removed it. // It can't have been protecting us against bad situations with zero-size // images since adding a border would make the rect non-empty. - + + nsDisplayList replacedContent; if (mComputedSize.width != 0 && mComputedSize.height != 0) { nsCOMPtr imageLoader = do_QueryInterface(mContent); NS_ASSERTION(imageLoader, "Not an image loading content?"); @@ -1276,13 +1277,13 @@ nsImageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, if (!imageOK || !haveSize) { // No image yet, or image load failed. Draw the alt-text and an icon // indicating the status - rv = aLists.Content()->AppendNewToTop(new (aBuilder) + rv = replacedContent.AppendNewToTop(new (aBuilder) nsDisplayGeneric(aBuilder, this, PaintAltFeedback, "AltFeedback", nsDisplayItem::TYPE_ALT_FEEDBACK)); NS_ENSURE_SUCCESS(rv, rv); } else { - rv = aLists.Content()->AppendNewToTop(new (aBuilder) + rv = replacedContent.AppendNewToTop(new (aBuilder) nsDisplayImage(aBuilder, this, imgCon)); NS_ENSURE_SUCCESS(rv, rv); @@ -1357,8 +1358,13 @@ nsImageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, } #endif - return DisplaySelectionOverlay(aBuilder, aLists.Content(), - nsISelectionDisplay::DISPLAY_IMAGES); + rv = DisplaySelectionOverlay(aBuilder, &replacedContent, + nsISelectionDisplay::DISPLAY_IMAGES); + NS_ENSURE_SUCCESS(rv, rv); + + WrapReplacedContentForBorderRadius(aBuilder, &replacedContent, aLists); + + return NS_OK; } NS_IMETHODIMP diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 9a402c208732..5f30cf8869ab 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -1353,7 +1353,7 @@ nsObjectFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, nsresult rv = DisplayBorderBackgroundOutline(aBuilder, aLists); NS_ENSURE_SUCCESS(rv, rv); - + nsPresContext::nsPresContextType type = PresContext()->Type(); // If we are painting in Print Preview do nothing.... @@ -1369,14 +1369,22 @@ nsObjectFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, } #endif + nsDisplayList replacedContent; + // determine if we are printing - if (type == nsPresContext::eContext_Print) - return aLists.Content()->AppendNewToTop(new (aBuilder) + if (type == nsPresContext::eContext_Print) { + rv = replacedContent.AppendNewToTop(new (aBuilder) nsDisplayGeneric(aBuilder, this, PaintPrintPlugin, "PrintPlugin", nsDisplayItem::TYPE_PRINT_PLUGIN)); + } else { + rv = replacedContent.AppendNewToTop(new (aBuilder) + nsDisplayPlugin(aBuilder, this)); + } + NS_ENSURE_SUCCESS(rv, rv); - return aLists.Content()->AppendNewToTop(new (aBuilder) - nsDisplayPlugin(aBuilder, this)); + WrapReplacedContentForBorderRadius(aBuilder, &replacedContent, aLists); + + return NS_OK; } void diff --git a/layout/generic/nsVideoFrame.cpp b/layout/generic/nsVideoFrame.cpp index d5b6566a2f41..29b52cce76b4 100644 --- a/layout/generic/nsVideoFrame.cpp +++ b/layout/generic/nsVideoFrame.cpp @@ -58,6 +58,7 @@ #include "nsImageFrame.h" #include "nsIImageLoadingContent.h" #include "nsDisplayList.h" +#include "nsCSSRendering.h" #ifdef ACCESSIBILITY #include "nsIServiceManager.h" @@ -417,8 +418,10 @@ nsVideoFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, nsresult rv = DisplayBorderBackgroundOutline(aBuilder, aLists); NS_ENSURE_SUCCESS(rv, rv); + nsDisplayList replacedContent; + if (HasVideoElement() && !ShouldDisplayPoster()) { - rv = aLists.Content()->AppendNewToTop( + rv = replacedContent.AppendNewToTop( new (aBuilder) nsDisplayVideo(aBuilder, this)); NS_ENSURE_SUCCESS(rv, rv); } @@ -431,16 +434,18 @@ nsVideoFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, if (child->GetType() == nsGkAtoms::imageFrame && ShouldDisplayPoster()) { rv = child->BuildDisplayListForStackingContext(aBuilder, aDirtyRect - child->GetOffsetTo(this), - aLists.Content()); + &replacedContent); NS_ENSURE_SUCCESS(rv,rv); } else if (child->GetType() == nsGkAtoms::boxFrame) { rv = child->BuildDisplayListForStackingContext(aBuilder, aDirtyRect - child->GetOffsetTo(this), - aLists.Content()); + &replacedContent); NS_ENSURE_SUCCESS(rv,rv); } } + WrapReplacedContentForBorderRadius(aBuilder, &replacedContent, aLists); + return NS_OK; } From 2ecdfeadc5c632f077bc0852cb516c82f8b1b4f4 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:47 -0700 Subject: [PATCH 063/176] Add reftests for clipping to the border-radius curve. (Bug 459144, Bug 485501) a2.0=blocking2.0:beta6 --- .../border-radius/clipping-4-canvas.html | 14 +++++ .../border-radius/clipping-4-image.html | 10 ++++ .../border-radius/clipping-4-notref.html | 10 ++++ .../clipping-4-overflow-hidden.html | 16 ++++++ .../border-radius/clipping-4-ref.html | 11 ++++ .../border-radius/clipping-5-canvas.html | 20 +++++++ .../border-radius/clipping-5-image.html | 16 ++++++ .../clipping-5-overflow-hidden.html | 24 ++++++++ .../border-radius/clipping-5-ref.html | 17 ++++++ .../border-radius/clipping-5-refc.html | 19 +++++++ .../border-radius/clipping-5-refi.html | 15 +++++ .../clipping-and-zindex-1-ref.html | 18 ++++++ .../border-radius/clipping-and-zindex-1.html | 19 +++++++ .../intersecting-clipping-1-canvas.html | 20 +++++++ .../intersecting-clipping-1-image.html | 16 ++++++ ...tersecting-clipping-1-overflow-hidden.html | 18 ++++++ .../intersecting-clipping-1-ref.html | 53 ++++++++++++++++++ .../intersecting-clipping-1-refc.html | 55 +++++++++++++++++++ .../intersecting-clipping-1-refi.html | 51 +++++++++++++++++ layout/reftests/border-radius/reftest.list | 17 ++++++ 20 files changed, 439 insertions(+) create mode 100644 layout/reftests/border-radius/clipping-4-canvas.html create mode 100644 layout/reftests/border-radius/clipping-4-image.html create mode 100644 layout/reftests/border-radius/clipping-4-notref.html create mode 100644 layout/reftests/border-radius/clipping-4-overflow-hidden.html create mode 100644 layout/reftests/border-radius/clipping-4-ref.html create mode 100644 layout/reftests/border-radius/clipping-5-canvas.html create mode 100644 layout/reftests/border-radius/clipping-5-image.html create mode 100644 layout/reftests/border-radius/clipping-5-overflow-hidden.html create mode 100644 layout/reftests/border-radius/clipping-5-ref.html create mode 100644 layout/reftests/border-radius/clipping-5-refc.html create mode 100644 layout/reftests/border-radius/clipping-5-refi.html create mode 100644 layout/reftests/border-radius/clipping-and-zindex-1-ref.html create mode 100644 layout/reftests/border-radius/clipping-and-zindex-1.html create mode 100644 layout/reftests/border-radius/intersecting-clipping-1-canvas.html create mode 100644 layout/reftests/border-radius/intersecting-clipping-1-image.html create mode 100644 layout/reftests/border-radius/intersecting-clipping-1-overflow-hidden.html create mode 100644 layout/reftests/border-radius/intersecting-clipping-1-ref.html create mode 100644 layout/reftests/border-radius/intersecting-clipping-1-refc.html create mode 100644 layout/reftests/border-radius/intersecting-clipping-1-refi.html diff --git a/layout/reftests/border-radius/clipping-4-canvas.html b/layout/reftests/border-radius/clipping-4-canvas.html new file mode 100644 index 000000000000..0fee7279e104 --- /dev/null +++ b/layout/reftests/border-radius/clipping-4-canvas.html @@ -0,0 +1,14 @@ + +Test for clipping of border-radius + + + diff --git a/layout/reftests/border-radius/clipping-4-image.html b/layout/reftests/border-radius/clipping-4-image.html new file mode 100644 index 000000000000..7d97c9f9643e --- /dev/null +++ b/layout/reftests/border-radius/clipping-4-image.html @@ -0,0 +1,10 @@ + +Test for clipping of border-radius + + diff --git a/layout/reftests/border-radius/clipping-4-notref.html b/layout/reftests/border-radius/clipping-4-notref.html new file mode 100644 index 000000000000..91d8daca8ea5 --- /dev/null +++ b/layout/reftests/border-radius/clipping-4-notref.html @@ -0,0 +1,10 @@ + +Test for clipping of border-radius + +
diff --git a/layout/reftests/border-radius/clipping-4-overflow-hidden.html b/layout/reftests/border-radius/clipping-4-overflow-hidden.html new file mode 100644 index 000000000000..eba5422f0c03 --- /dev/null +++ b/layout/reftests/border-radius/clipping-4-overflow-hidden.html @@ -0,0 +1,16 @@ + +Test for clipping of border-radius + +
diff --git a/layout/reftests/border-radius/clipping-4-ref.html b/layout/reftests/border-radius/clipping-4-ref.html new file mode 100644 index 000000000000..02c6bf548075 --- /dev/null +++ b/layout/reftests/border-radius/clipping-4-ref.html @@ -0,0 +1,11 @@ + +Test for clipping of border-radius + +
diff --git a/layout/reftests/border-radius/clipping-5-canvas.html b/layout/reftests/border-radius/clipping-5-canvas.html new file mode 100644 index 000000000000..bc64b28b1308 --- /dev/null +++ b/layout/reftests/border-radius/clipping-5-canvas.html @@ -0,0 +1,20 @@ + +Test for clipping of border-radius + + + diff --git a/layout/reftests/border-radius/clipping-5-image.html b/layout/reftests/border-radius/clipping-5-image.html new file mode 100644 index 000000000000..43ca9eea719f --- /dev/null +++ b/layout/reftests/border-radius/clipping-5-image.html @@ -0,0 +1,16 @@ + +Test for clipping of border-radius + + diff --git a/layout/reftests/border-radius/clipping-5-overflow-hidden.html b/layout/reftests/border-radius/clipping-5-overflow-hidden.html new file mode 100644 index 000000000000..a3af7a15290f --- /dev/null +++ b/layout/reftests/border-radius/clipping-5-overflow-hidden.html @@ -0,0 +1,24 @@ + +Test for clipping of border-radius + +
diff --git a/layout/reftests/border-radius/clipping-5-ref.html b/layout/reftests/border-radius/clipping-5-ref.html new file mode 100644 index 000000000000..e056c307c32f --- /dev/null +++ b/layout/reftests/border-radius/clipping-5-ref.html @@ -0,0 +1,17 @@ + +Test for clipping of border-radius + +
diff --git a/layout/reftests/border-radius/clipping-5-refc.html b/layout/reftests/border-radius/clipping-5-refc.html new file mode 100644 index 000000000000..39282b5aa60c --- /dev/null +++ b/layout/reftests/border-radius/clipping-5-refc.html @@ -0,0 +1,19 @@ + +Test for clipping of border-radius + + + diff --git a/layout/reftests/border-radius/clipping-5-refi.html b/layout/reftests/border-radius/clipping-5-refi.html new file mode 100644 index 000000000000..cba5f5405c74 --- /dev/null +++ b/layout/reftests/border-radius/clipping-5-refi.html @@ -0,0 +1,15 @@ + +Test for clipping of border-radius + + diff --git a/layout/reftests/border-radius/clipping-and-zindex-1-ref.html b/layout/reftests/border-radius/clipping-and-zindex-1-ref.html new file mode 100644 index 000000000000..a6900762be64 --- /dev/null +++ b/layout/reftests/border-radius/clipping-and-zindex-1-ref.html @@ -0,0 +1,18 @@ + +Test for z-index relationship to border-radius clipping of overflow + + +
+
+
diff --git a/layout/reftests/border-radius/clipping-and-zindex-1.html b/layout/reftests/border-radius/clipping-and-zindex-1.html new file mode 100644 index 000000000000..37842140dfdb --- /dev/null +++ b/layout/reftests/border-radius/clipping-and-zindex-1.html @@ -0,0 +1,19 @@ + +Test for z-index relationship to border-radius clipping of overflow + + +
+
+
diff --git a/layout/reftests/border-radius/intersecting-clipping-1-canvas.html b/layout/reftests/border-radius/intersecting-clipping-1-canvas.html new file mode 100644 index 000000000000..10a0089b8333 --- /dev/null +++ b/layout/reftests/border-radius/intersecting-clipping-1-canvas.html @@ -0,0 +1,20 @@ + +Test for clipping of border-radius + +
+ diff --git a/layout/reftests/border-radius/intersecting-clipping-1-image.html b/layout/reftests/border-radius/intersecting-clipping-1-image.html new file mode 100644 index 000000000000..5d6f7d88a131 --- /dev/null +++ b/layout/reftests/border-radius/intersecting-clipping-1-image.html @@ -0,0 +1,16 @@ + +Test for clipping of border-radius + +
diff --git a/layout/reftests/border-radius/intersecting-clipping-1-overflow-hidden.html b/layout/reftests/border-radius/intersecting-clipping-1-overflow-hidden.html new file mode 100644 index 000000000000..44c0c14dabe5 --- /dev/null +++ b/layout/reftests/border-radius/intersecting-clipping-1-overflow-hidden.html @@ -0,0 +1,18 @@ + +Test for clipping of border-radius + +
diff --git a/layout/reftests/border-radius/intersecting-clipping-1-ref.html b/layout/reftests/border-radius/intersecting-clipping-1-ref.html new file mode 100644 index 000000000000..d6db26875ab1 --- /dev/null +++ b/layout/reftests/border-radius/intersecting-clipping-1-ref.html @@ -0,0 +1,53 @@ + +Test for clipping of border-radius + +
+
+ + + +
+
+
+
+
+
+
+
+
+ +
+
+
+
+ +
diff --git a/layout/reftests/border-radius/intersecting-clipping-1-refc.html b/layout/reftests/border-radius/intersecting-clipping-1-refc.html new file mode 100644 index 000000000000..aad87ebbdf0a --- /dev/null +++ b/layout/reftests/border-radius/intersecting-clipping-1-refc.html @@ -0,0 +1,55 @@ + +Test for clipping of border-radius + +
+
+ + + + +
+
+
+
+
+
+
+
+
+ +
+
+
+
+ +
diff --git a/layout/reftests/border-radius/intersecting-clipping-1-refi.html b/layout/reftests/border-radius/intersecting-clipping-1-refi.html new file mode 100644 index 000000000000..239ab86c4f9a --- /dev/null +++ b/layout/reftests/border-radius/intersecting-clipping-1-refi.html @@ -0,0 +1,51 @@ + +Test for clipping of border-radius + +
+
+ + + +
+
+
+
+
+
+
+
+
+ +
+
+
+
+ +
diff --git a/layout/reftests/border-radius/reftest.list b/layout/reftests/border-radius/reftest.list index 97c9940e0a90..15dd1485f850 100644 --- a/layout/reftests/border-radius/reftest.list +++ b/layout/reftests/border-radius/reftest.list @@ -39,6 +39,23 @@ fails == clipping-1.html clipping-1-ref.html # background color should completel # great tests for this due to antialiasing problems described in bug 466572 == clipping-3.html clipping-3-ref.xhtml # edge of border-radius clips an underlying object's background +# Tests for clipping the contents of replaced elements and overflow!=visible +!= clipping-4-ref.html clipping-4-notref.html +fails-if(cocoaWidget) == clipping-4-canvas.html clipping-4-ref.html +== clipping-4-image.html clipping-4-ref.html +== clipping-4-overflow-hidden.html clipping-4-ref.html +== clipping-5-canvas.html clipping-5-refc.html +== clipping-5-image.html clipping-5-refi.html +== clipping-5-overflow-hidden.html clipping-5-ref.html +== clipping-5-refi.html clipping-5-ref.html +fails-if(cocoaWidget) == clipping-5-refc.html clipping-5-ref.html +== clipping-and-zindex-1.html clipping-and-zindex-1-ref.html +== intersecting-clipping-1-canvas.html intersecting-clipping-1-refc.html +== intersecting-clipping-1-image.html intersecting-clipping-1-refi.html +== intersecting-clipping-1-overflow-hidden.html intersecting-clipping-1-ref.html +== intersecting-clipping-1-refi.html intersecting-clipping-1-ref.html +fails-if(cocoaWidget) == intersecting-clipping-1-refc.html intersecting-clipping-1-ref.html + # Inheritance == inherit-1.html inherit-1-ref.html # border-radius shouldn't inherit From 00da671cec1f1e4144e61319157bee90eb586298 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:47 -0700 Subject: [PATCH 064/176] Add workaround for bad pixel in pluginproblem reftest. (Bug 459144) a2.0=blocking2.0:beta6 --HG-- rename : modules/plugin/test/reftest/pluginproblemui-direction-ref.html => modules/plugin/test/reftest/pluginproblemui-direction-1-ref.html rename : modules/plugin/test/reftest/pluginproblemui-direction-ref.html => modules/plugin/test/reftest/pluginproblemui-direction-2-ref.html rename : modules/plugin/test/reftest/pluginproblemui-direction-1.html => modules/plugin/test/reftest/pluginproblemui-direction-2.html --- ...l => pluginproblemui-direction-1-ref.html} | 0 .../pluginproblemui-direction-2-ref.html | 25 +++++++++++++++++++ .../reftest/pluginproblemui-direction-2.html | 25 +++++++++++++++++++ modules/plugin/test/reftest/reftest.list | 3 ++- 4 files changed, 52 insertions(+), 1 deletion(-) rename modules/plugin/test/reftest/{pluginproblemui-direction-ref.html => pluginproblemui-direction-1-ref.html} (100%) create mode 100644 modules/plugin/test/reftest/pluginproblemui-direction-2-ref.html create mode 100644 modules/plugin/test/reftest/pluginproblemui-direction-2.html diff --git a/modules/plugin/test/reftest/pluginproblemui-direction-ref.html b/modules/plugin/test/reftest/pluginproblemui-direction-1-ref.html similarity index 100% rename from modules/plugin/test/reftest/pluginproblemui-direction-ref.html rename to modules/plugin/test/reftest/pluginproblemui-direction-1-ref.html diff --git a/modules/plugin/test/reftest/pluginproblemui-direction-2-ref.html b/modules/plugin/test/reftest/pluginproblemui-direction-2-ref.html new file mode 100644 index 000000000000..fdfd9b694218 --- /dev/null +++ b/modules/plugin/test/reftest/pluginproblemui-direction-2-ref.html @@ -0,0 +1,25 @@ + + + + Plugin Problem UI directionality test + + + +
+ + + + diff --git a/modules/plugin/test/reftest/pluginproblemui-direction-2.html b/modules/plugin/test/reftest/pluginproblemui-direction-2.html new file mode 100644 index 000000000000..84c3f308898a --- /dev/null +++ b/modules/plugin/test/reftest/pluginproblemui-direction-2.html @@ -0,0 +1,25 @@ + + + + Plugin Problem UI directionality test + + + +
+ + + + diff --git a/modules/plugin/test/reftest/reftest.list b/modules/plugin/test/reftest/reftest.list index ccb678713dbb..81274e0511ed 100644 --- a/modules/plugin/test/reftest/reftest.list +++ b/modules/plugin/test/reftest/reftest.list @@ -6,6 +6,7 @@ fails-if(!haveTestPlugin) == plugin-alpha-opacity.html div-alpha-opacity.html fails-if(!haveTestPlugin) == windowless-clipping-1.html windowless-clipping-1-ref.html fails-if(!haveTestPlugin) == border-padding-1.html border-padding-1-ref.html fails-if(!haveTestPlugin) == border-padding-2.html border-padding-2-ref.html -asserts-if(http.oscpu.match(/Linux/),0-1) fails-if(!haveTestPlugin) skip-if(!prefs.getBoolPref("dom.ipc.plugins.enabled")) == pluginproblemui-direction-1.html pluginproblemui-direction-ref.html # assertion is bug 585394 +asserts-if(http.oscpu.match(/Linux/),0-1) random-if(d2d) fails-if(!haveTestPlugin) skip-if(!prefs.getBoolPref("dom.ipc.plugins.enabled")) == pluginproblemui-direction-1.html pluginproblemui-direction-1-ref.html # assertion is bug 585394 +asserts-if(http.oscpu.match(/Linux/),0-1) fails-if(!haveTestPlugin) skip-if(!prefs.getBoolPref("dom.ipc.plugins.enabled")) == pluginproblemui-direction-2.html pluginproblemui-direction-2-ref.html # assertion is bug 585394 # Disabled for now to investigate Windows/Linux test failures # fails-if(!haveTestPlugin) == border-padding-3.html border-padding-3-ref.html From 8537cb241d7d8145a6852b2885525ec280cf10de Mon Sep 17 00:00:00 2001 From: "Zack Weinberg ext:(%2C%20L.%20David%20Baron%20%3Cdbaron%40dbaron.org%3E)" Date: Thu, 9 Sep 2010 08:21:47 -0700 Subject: [PATCH 065/176] Bug 451134 (1/2): switch to the official border-radius property names: purely mechanical changes. r=dbaron a2.0=blocking2.0:beta6 This was generated with the command: LC_ALL=C grep -irlEZe '[-_]moz[-_]border[-_]radius([-_](top|bottom)(right|left))?' * | xargs -0 perl -pi -e \ 's/-moz-border-radius-(top|bottom)(left|right)/border-${1}-${2}-radius/gi; s/_moz_border_radius_(top|bottom)Right/border_${1}_right_radius/g; s/_moz_border_radius_(top|bottom)Left/border_${1}_left_radius/g; s/-moz-border-radius/border-radius/gi; s/_moz_border_radius/border_radius/g;' --- .../content/browser.css | 2 +- .../content/screen.css | 10 ++-- .../skin/all/css/screen-standalone.css | 14 ++--- .../skin/linux/feedback.css | 2 +- .../skin/mac/feedback.css | 2 +- browser/base/content/aboutHome.css | 4 +- browser/base/content/tabview/tabview.css | 2 +- .../gnomestripe/browser/aboutCertError.css | 2 +- .../gnomestripe/browser/aboutSyncTabs.css | 4 +- .../themes/gnomestripe/browser/browser.css | 8 +-- .../gnomestripe/browser/feeds/subscribe.css | 2 +- .../themes/gnomestripe/browser/inspector.css | 2 +- .../browser/preferences/preferences.css | 2 +- .../gnomestripe/browser/sanitizeDialog.css | 2 +- .../themes/gnomestripe/browser/syncSetup.css | 4 +- .../gnomestripe/browser/tabview/tabview.css | 16 +++--- .../pinstripe/browser/aboutCertError.css | 2 +- .../pinstripe/browser/aboutSyncTabs.css | 4 +- browser/themes/pinstripe/browser/browser.css | 54 +++++++++---------- .../pinstripe/browser/feeds/subscribe.css | 2 +- .../themes/pinstripe/browser/inspector.css | 2 +- .../browser/places/editBookmarkOverlay.css | 4 +- .../pinstripe/browser/places/organizer.css | 14 ++--- .../pinstripe/browser/places/places.css | 2 +- .../pinstripe/browser/sanitizeDialog.css | 2 +- .../themes/pinstripe/browser/searchbar.css | 2 +- browser/themes/pinstripe/browser/shared.inc | 2 +- .../themes/pinstripe/browser/syncSetup.css | 4 +- .../pinstripe/browser/tabview/tabview.css | 16 +++--- .../winstripe/browser/aboutCertError.css | 2 +- .../winstripe/browser/aboutSyncTabs.css | 4 +- .../themes/winstripe/browser/browser-aero.css | 4 +- browser/themes/winstripe/browser/browser.css | 48 ++++++++--------- .../winstripe/browser/feeds/subscribe.css | 2 +- .../themes/winstripe/browser/inspector.css | 2 +- .../winstripe/browser/places/organizer.css | 2 +- .../browser/preferences/preferences.css | 2 +- .../winstripe/browser/sanitizeDialog.css | 2 +- .../themes/winstripe/browser/syncSetup.css | 4 +- .../winstripe/browser/tabview/tabview.css | 16 +++--- layout/base/crashtests/265736-2.html | 2 +- layout/base/crashtests/485501-1.html | 2 +- layout/base/nsCSSRendering.cpp | 2 +- layout/forms/resources/skin/radio.css | 4 +- .../border-radius/border-circle-2.html | 4 +- .../reftests/border-radius/border-circle.html | 2 +- .../reftests/border-radius/border-ellips.html | 2 +- .../border-reduce-height-ref.html | 2 +- .../border-radius/border-reduce-height.html | 2 +- .../border-value-interpret-ref.html | 8 +-- .../border-radius/border-value-interpret.html | 2 +- .../border-radius/clipping-1-ref.html | 4 +- layout/reftests/border-radius/clipping-1.html | 2 +- layout/reftests/border-radius/clipping-2.html | 4 +- layout/reftests/border-radius/clipping-3.html | 2 +- .../border-radius/clipping-4-canvas.html | 2 +- .../border-radius/clipping-4-image.html | 2 +- .../clipping-4-overflow-hidden.html | 2 +- .../border-radius/clipping-4-ref.html | 2 +- .../border-radius/clipping-5-canvas.html | 2 +- .../border-radius/clipping-5-image.html | 2 +- .../clipping-5-overflow-hidden.html | 2 +- .../border-radius/clipping-5-ref.html | 4 +- .../border-radius/clipping-5-refc.html | 4 +- .../border-radius/clipping-5-refi.html | 4 +- .../clipping-and-zindex-1-ref.html | 2 +- .../border-radius/clipping-and-zindex-1.html | 2 +- layout/reftests/border-radius/corner-1.html | 2 +- layout/reftests/border-radius/corner-2.html | 2 +- .../curved-borders-all-styles.html | 2 +- .../border-radius/curved-stripe-border.html | 2 +- .../reftests/border-radius/inherit-1-ref.html | 4 +- layout/reftests/border-radius/inherit-1.html | 2 +- .../intersecting-clipping-1-canvas.html | 4 +- .../intersecting-clipping-1-image.html | 4 +- ...tersecting-clipping-1-overflow-hidden.html | 4 +- .../intersecting-clipping-1-ref.html | 4 +- .../intersecting-clipping-1-refc.html | 4 +- .../intersecting-clipping-1-refi.html | 4 +- .../border-radius/invalidate-1-ref.html | 2 +- .../reftests/border-radius/invalidate-1a.html | 2 +- .../reftests/border-radius/invalidate-1b.html | 2 +- .../reftests/border-radius/percent-1-ref.html | 32 +++++------ layout/reftests/border-radius/percent-1.html | 2 +- .../reftests/border-radius/percent-2-ref.html | 32 +++++------ layout/reftests/border-radius/percent-2.html | 2 +- .../reftests/border-radius/percent-3-ref.html | 32 +++++------ layout/reftests/border-radius/percent-3.html | 2 +- .../scrollbar-clamping-1-ref.html | 10 ++-- .../border-radius/scrollbar-clamping-1.html | 4 +- .../scrollbar-clamping-2-ref.html | 8 +-- .../border-radius/scrollbar-clamping-2.html | 2 +- .../border-radius/table-collapse-1.html | 2 +- .../box-shadow/boxshadow-dynamic-ref.xul | 2 +- .../reftests/box-shadow/boxshadow-dynamic.xul | 2 +- .../box-shadow/boxshadow-inner-basic.html | 2 +- .../box-shadow/boxshadow-mixed-ref.html | 2 +- .../reftests/box-shadow/boxshadow-mixed.html | 2 +- .../box-shadow/boxshadow-onecorner-ref.html | 4 +- .../box-shadow/boxshadow-onecorner.html | 2 +- .../boxshadow-rounded-spread-ref.html | 2 +- .../box-shadow/boxshadow-rounded-spread.html | 2 +- layout/reftests/bugs/24998-1-ref.html | 2 +- layout/reftests/bugs/24998-1.html | 4 +- layout/reftests/bugs/364861-1-ref.html | 2 +- layout/reftests/bugs/364861-1.html | 2 +- layout/reftests/bugs/368247-1-ref.html | 4 +- layout/reftests/bugs/368247-1.html | 2 +- layout/reftests/bugs/368247-2-ref.html | 2 +- layout/reftests/bugs/368247-2.html | 2 +- layout/reftests/bugs/384576-1.html | 2 +- layout/reftests/bugs/399258-1.html | 2 +- layout/reftests/bugs/438537-1-ref.html | 2 +- layout/reftests/bugs/438537-1.html | 2 +- layout/reftests/bugs/456219-1-ref.html | 10 ++-- layout/reftests/bugs/456219-1a.html | 10 ++-- layout/reftests/bugs/456219-1b.html | 10 ++-- layout/reftests/bugs/456219-1c.html | 10 ++-- layout/reftests/bugs/456219-2-ref.html | 2 +- layout/reftests/bugs/456219-2.html | 2 +- layout/reftests/bugs/474336-1-ref.xul | 2 +- layout/reftests/bugs/474336-1.xul | 2 +- layout/reftests/bugs/526463-1-ref.html | 2 +- layout/reftests/bugs/526463-1.html | 2 +- .../css-calc/border-radius-1-ref.html | 2 +- layout/reftests/css-calc/border-radius-1.html | 2 +- layout/reftests/editor/xul/input.css | 4 +- .../reftests/first-line/border-not-apply.html | 2 +- .../element-paint-sharpness-01a.html | 2 +- .../element-paint-sharpness-01b.html | 2 +- .../element-paint-sharpness-01c.html | 2 +- .../element-paint-sharpness-01d.html | 2 +- .../element-paint-sharpness-02a.html | 2 +- .../element-paint-sharpness-02b.html | 2 +- .../element-paint-sharpness-02c.html | 2 +- .../rounded-background-color-base-ref.html | 16 +++--- ...ounded-background-color-height-10-ref.html | 16 +++--- .../rounded-background-color-height-4.html | 16 +++--- .../rounded-background-color-height-5.html | 16 +++--- .../rounded-background-color-height-6.html | 16 +++--- ...rounded-background-color-height-top-4.html | 16 +++--- ...rounded-background-color-height-top-5.html | 16 +++--- ...rounded-background-color-height-top-6.html | 16 +++--- .../rounded-background-color-left-10-ref.html | 16 +++--- .../rounded-background-color-left-4.html | 16 +++--- .../rounded-background-color-left-5.html | 16 +++--- .../rounded-background-color-left-6.html | 16 +++--- ...rounded-background-color-left-width-4.html | 16 +++--- ...rounded-background-color-left-width-5.html | 16 +++--- ...rounded-background-color-left-width-6.html | 16 +++--- .../rounded-background-color-top-10-ref.html | 16 +++--- .../rounded-background-color-top-4.html | 16 +++--- .../rounded-background-color-top-5.html | 16 +++--- .../rounded-background-color-top-6.html | 16 +++--- ...rounded-background-color-top-height-4.html | 16 +++--- ...rounded-background-color-top-height-5.html | 16 +++--- ...rounded-background-color-top-height-6.html | 16 +++--- ...rounded-background-color-width-10-ref.html | 16 +++--- .../rounded-background-color-width-4.html | 16 +++--- .../rounded-background-color-width-5.html | 16 +++--- .../rounded-background-color-width-6.html | 16 +++--- ...rounded-background-color-width-left-4.html | 16 +++--- ...rounded-background-color-width-left-5.html | 16 +++--- ...rounded-background-color-width-left-6.html | 16 +++--- layout/style/Declaration.cpp | 2 +- layout/style/forms.css | 4 +- layout/style/nsCSSParser.cpp | 28 +++++----- layout/style/nsCSSPropList.h | 20 +++---- layout/style/nsCSSProps.cpp | 8 +-- layout/style/nsComputedDOMStyle.cpp | 8 +-- layout/style/nsRuleNode.cpp | 2 +- layout/style/test/property_database.js | 12 ++--- layout/style/test/test_bug365932.html | 10 ++-- .../test/test_priority_preservation.html | 24 ++++----- .../test/test_transitions_per_property.html | 8 +-- layout/style/test/test_value_computation.html | 10 ++-- .../css/smoothness/jquery-ui-1.7.1.custom.css | 20 +++---- .../aboutmemory/content/aboutMemory.css | 2 +- toolkit/themes/faststripe/global/button.css | 4 +- toolkit/themes/faststripe/global/groupbox.css | 2 +- toolkit/themes/faststripe/global/radio.css | 4 +- toolkit/themes/faststripe/global/tabbox.css | 24 ++++----- .../themes/gnomestripe/global/netError.css | 4 +- toolkit/themes/gnomestripe/global/radio.css | 4 +- toolkit/themes/gnomestripe/global/tabbox.css | 16 +++--- .../global/webConsole_networkPanel.css | 4 +- .../mozapps/extensions/extensions.css | 26 ++++----- toolkit/themes/pinstripe/global/config.css | 2 +- .../pinstripe/global/console/console.css | 4 +- .../pinstripe/global/datetimepicker.css | 4 +- .../global/dirListing/dirListing.css | 2 +- toolkit/themes/pinstripe/global/findBar.css | 16 +++--- toolkit/themes/pinstripe/global/global.css | 2 +- .../pinstripe/global/media/videocontrols.css | 8 +-- toolkit/themes/pinstripe/global/netError.css | 4 +- .../themes/pinstripe/global/notification.css | 2 +- toolkit/themes/pinstripe/global/numberbox.css | 4 +- toolkit/themes/pinstripe/global/tabbox.css | 2 +- toolkit/themes/pinstripe/global/textbox.css | 4 +- .../themes/pinstripe/global/viewbuttons.css | 10 ++-- .../global/webConsole_networkPanel.css | 4 +- .../pinstripe/mozapps/downloads/downloads.css | 2 +- .../pinstripe/mozapps/extensions/eula.css | 4 +- .../mozapps/extensions/extensions.css | 40 +++++++------- .../mozapps/plugins/pluginProblem.css | 2 +- .../pinstripe/mozapps/update/updates.css | 2 +- toolkit/themes/winstripe/global/about.css | 2 +- .../themes/winstripe/global/aboutCache.css | 2 +- toolkit/themes/winstripe/global/config.css | 2 +- .../global/dirListing/dirListing.css | 2 +- toolkit/themes/winstripe/global/groupbox.css | 2 +- .../winstripe/global/media/videocontrols.css | 8 +-- toolkit/themes/winstripe/global/netError.css | 4 +- toolkit/themes/winstripe/global/radio.css | 4 +- toolkit/themes/winstripe/global/tabbox.css | 24 ++++----- .../global/webConsole_networkPanel.css | 4 +- .../mozapps/extensions/extensions.css | 32 +++++------ .../mozapps/plugins/pluginProblem.css | 2 +- 218 files changed, 781 insertions(+), 781 deletions(-) diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/browser.css b/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/browser.css index a7900c2094aa..9cb1ed7ee4e5 100644 --- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/browser.css +++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/browser.css @@ -172,7 +172,7 @@ image.study-result { color: white; font-weight: bold; padding: 2px; - -moz-border-radius: 10000px; + border-radius: 10000px; margin-right: 25px; margin-bottom: 13px; } diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/screen.css b/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/screen.css index 17a8970576bd..d60ae6a4e106 100644 --- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/screen.css +++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/screen.css @@ -102,7 +102,7 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype'); font-size: 16px; padding: 8px 12px; color: rgba(0, 0, 0, 0.8); - -moz-border-radius: 0.5em; + border-radius: 0.5em; -webkit-border-radius: 0.5em; -moz-box-shadow: inset rgba(0, 0, 0, 0.2) 0 1px 1px, @@ -122,7 +122,7 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype'); padding: 8px 12px; width: 240px; color: rgba(0, 0, 0, 0.8); - -moz-border-radius: 0.5em; + border-radius: 0.5em; -webkit-border-radius: 0.5em; -moz-box-shadow: inset rgba(0, 0, 0, 0.2) 0 1px 1px, @@ -143,7 +143,7 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype'); padding: 8px 24px; margin: 24px auto; color: rgba(0, 0, 0, 0.8); - -moz-border-radius: 0.5em; + border-radius: 0.5em; -webkit-border-radius: 0.5em; background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/callout.png') no-repeat top center; -moz-box-shadow: @@ -161,7 +161,7 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype'); padding: 8px 24px; margin: 8px auto; color: rgba(0, 0, 0, 0.8); - -moz-border-radius: 0.5em; + border-radius: 0.5em; -webkit-border-radius: 0.5em; background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/callout.png') no-repeat top center; -moz-box-shadow: @@ -197,7 +197,7 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype'); padding: 4px 40px; width: 800px; text-align: left; - -moz-border-radius: 0.25em; + border-radius: 0.25em; -webkit-border-radius: 0.25em; border-top: 1px solid #adb6ba; border-left: 1px solid #adb6ba; diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/skin/all/css/screen-standalone.css b/browser/app/profile/extensions/testpilot@labs.mozilla.com/skin/all/css/screen-standalone.css index 4afffa05091a..abdc2f4c8187 100644 --- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/skin/all/css/screen-standalone.css +++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/skin/all/css/screen-standalone.css @@ -52,7 +52,7 @@ body { .dataBox { font-size: 16px; padding: 6px 20px 20px 20px; - -moz-border-radius: 0.5em; + border-radius: 0.5em; -webkit-border-radius: 0.5em; background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/images/callout.png') no-repeat top center; //display: inline; @@ -113,7 +113,7 @@ body { font-size: 16px; padding: 8px 12px; color: rgba(0, 0, 0, 0.8); - -moz-border-radius: 0.5em; + border-radius: 0.5em; -webkit-border-radius: 0.5em; -moz-box-shadow: inset rgba(0, 0, 0, 0.2) 0 1px 1px, @@ -132,7 +132,7 @@ body { padding: 8px 12px; width: 240px; color: rgba(0, 0, 0, 0.8); - -moz-border-radius: 0.5em; + border-radius: 0.5em; -webkit-border-radius: 0.5em; -moz-box-shadow: inset rgba(0, 0, 0, 0.2) 0 1px 1px, @@ -151,7 +151,7 @@ body { padding: 8px 24px; margin: 24px auto; color: rgba(0, 0, 0, 0.8); - -moz-border-radius: 0.5em; + border-radius: 0.5em; -webkit-border-radius: 0.5em; background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/images/callout.png') no-repeat top center; -moz-box-shadow: @@ -173,7 +173,7 @@ body { padding: 8px 24px; margin: 8px auto; color: rgba(0, 0, 0, 0.8); - -moz-border-radius: 0.5em; + border-radius: 0.5em; -webkit-border-radius: 0.5em; background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/images/callout.png') no-repeat top center; -moz-box-shadow: @@ -190,7 +190,7 @@ body { padding: 8px 24px; margin: 8px auto; color: rgba(0, 0, 0, 0.8); - -moz-border-radius: 0.5em; + border-radius: 0.5em; -webkit-border-radius: 0.5em; background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/images/callout_continue.png') no-repeat top center; -moz-box-shadow: @@ -237,7 +237,7 @@ body { padding: 4px 40px; width: 800px; text-align: left; - -moz-border-radius: 0.25em; + border-radius: 0.25em; -webkit-border-radius: 0.25em; border-top: 1px solid #adb6ba; border-left: 1px solid #adb6ba; diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/skin/linux/feedback.css b/browser/app/profile/extensions/testpilot@labs.mozilla.com/skin/linux/feedback.css index 343cfd581af1..851182417cd7 100644 --- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/skin/linux/feedback.css +++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/skin/linux/feedback.css @@ -8,7 +8,7 @@ background-image: -moz-linear-gradient(hsla(0,0%,100%,.2), transparent); -moz-box-shadow: inset 0 0 10px hsla(0,0%,100%,.2), inset 0 1px 0 hsla(0,0%,100%,.3); - -moz-border-radius: 4px; + border-radius: 4px; border: 1px solid Menu; margin: -6px 0 0 0; width: 480px; diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/skin/mac/feedback.css b/browser/app/profile/extensions/testpilot@labs.mozilla.com/skin/mac/feedback.css index c2285ebfdea1..228ef2187d03 100644 --- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/skin/mac/feedback.css +++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/skin/mac/feedback.css @@ -7,7 +7,7 @@ rgba(60,60,60,.9) 51%, rgba(50,50,50,.9)); background-clip: padding-box; background-origin: padding-box; - -moz-border-radius: 12px; + border-radius: 12px; border: 1px solid rgba(0,0,0,.65); -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), inset 0 0 1px rgba(255,255,255,.1), diff --git a/browser/base/content/aboutHome.css b/browser/base/content/aboutHome.css index 565347c37427..b8c39f7aec50 100644 --- a/browser/base/content/aboutHome.css +++ b/browser/base/content/aboutHome.css @@ -54,7 +54,7 @@ html { #brandStart { background: -moz-linear-gradient(top, #42607C, #1E4262 30%, #1E4262 80%, #143552 98%, #244665); - -moz-border-radius: 5.6px; + border-radius: 5.6px; padding-bottom: 0.2em; -moz-padding-start: 0.5em; font-size: 250%; @@ -82,7 +82,7 @@ body[dir="rtl"] #brandStart:before { #searchContainer { border: 1px solid ThreeDShadow; - -moz-border-radius: 5.6px; + border-radius: 5.6px; padding: 3em; } #searchEngineLinks { diff --git a/browser/base/content/tabview/tabview.css b/browser/base/content/tabview/tabview.css index f785ac7dcfb6..8ef2eff5261f 100644 --- a/browser/base/content/tabview/tabview.css +++ b/browser/base/content/tabview/tabview.css @@ -82,7 +82,7 @@ body { .front { z-index: 999999 !important; - -moz-border-radius: 0 !important; + border-radius: 0 !important; -moz-box-shadow: none !important; -moz-transform: none !important; image-rendering: -moz-crisp-edges; diff --git a/browser/themes/gnomestripe/browser/aboutCertError.css b/browser/themes/gnomestripe/browser/aboutCertError.css index 7f0df7fe9f63..e0d9e9b9347e 100644 --- a/browser/themes/gnomestripe/browser/aboutCertError.css +++ b/browser/themes/gnomestripe/browser/aboutCertError.css @@ -67,7 +67,7 @@ h2 { max-width: 52em; margin: 4em auto; border: 1px solid #FFBD09; /* pale yellow extracted from yellow passport icon */ - -moz-border-radius: 10px; + border-radius: 10px; padding: 3em; -moz-padding-start: 30px; background: url("chrome://global/skin/icons/sslWarning.png") left 0 no-repeat -moz-Field; diff --git a/browser/themes/gnomestripe/browser/aboutSyncTabs.css b/browser/themes/gnomestripe/browser/aboutSyncTabs.css index a2f75766edf1..8795e08ed65f 100644 --- a/browser/themes/gnomestripe/browser/aboutSyncTabs.css +++ b/browser/themes/gnomestripe/browser/aboutSyncTabs.css @@ -43,7 +43,7 @@ richlistitem[type="tab"] { padding: 2px 5px; margin-bottom: 4px; -moz-margin-start: 4em; - -moz-border-radius: 6px; + border-radius: 6px; background-color: menu; width: 44em; opacity: 0.9; @@ -64,7 +64,7 @@ richlistitem[type="client"] { margin-top: 2px; margin-bottom: 3px; width: 42em; - -moz-border-radius: 6px; + border-radius: 6px; background-color: transparent; -moz-user-focus: ignore !important; } diff --git a/browser/themes/gnomestripe/browser/browser.css b/browser/themes/gnomestripe/browser/browser.css index 8b511e941561..c0c5acf9d2a9 100644 --- a/browser/themes/gnomestripe/browser/browser.css +++ b/browser/themes/gnomestripe/browser/browser.css @@ -1155,8 +1155,8 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- background-origin: border-box; border: none; border-left: 1px solid rgba(0,0,0,.35); - -moz-border-radius-topright: 2px; - -moz-border-radius-bottomright: 2px; + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; } #urlbar > toolbarbutton:active:hover { @@ -1320,7 +1320,7 @@ statusbarpanel#statusbar-display { margin: 0; padding: 0; -moz-border-image: url(tabbrowser/tab.png) 4 5 3 6 / 4px 5px 3px 6px; - -moz-border-radius: 10px 8px 0 0; + border-radius: 10px 8px 0 0; min-height: 25px; /* reserve space for the sometimes hidden close button */ } @@ -1515,7 +1515,7 @@ statusbarpanel#statusbar-display { -moz-appearance: tab-scroll-arrow-forward; margin: 0; -moz-transition: 1s -moz-box-shadow ease-out; - -moz-border-radius: 4px; + border-radius: 4px; } .tabbrowser-arrowscrollbox > .scrollbutton-down[notifybgtab] { diff --git a/browser/themes/gnomestripe/browser/feeds/subscribe.css b/browser/themes/gnomestripe/browser/feeds/subscribe.css index 15504baa34c8..01cc66056c39 100644 --- a/browser/themes/gnomestripe/browser/feeds/subscribe.css +++ b/browser/themes/gnomestripe/browser/feeds/subscribe.css @@ -13,7 +13,7 @@ html { #feedHeaderContainer { border: 1px solid ThreeDShadow; - -moz-border-radius: 10px; + border-radius: 10px; margin: -4em auto 0 auto; background-color: InfoBackground; } diff --git a/browser/themes/gnomestripe/browser/inspector.css b/browser/themes/gnomestripe/browser/inspector.css index c2764611e21a..1bcb4e810f7b 100644 --- a/browser/themes/gnomestripe/browser/inspector.css +++ b/browser/themes/gnomestripe/browser/inspector.css @@ -171,7 +171,7 @@ code { .nodeCloseLabel { margin: -2px 2px 0 2px; border: 2px solid transparent; - -moz-border-radius: 3px; + border-radius: 3px; padding: 0 2px; color: #000088; } diff --git a/browser/themes/gnomestripe/browser/preferences/preferences.css b/browser/themes/gnomestripe/browser/preferences/preferences.css index a25a0b96f267..bd6b223bd903 100644 --- a/browser/themes/gnomestripe/browser/preferences/preferences.css +++ b/browser/themes/gnomestripe/browser/preferences/preferences.css @@ -147,7 +147,7 @@ radio[pane=paneSync] { #cookieInfoBox { border: 1px solid ThreeDShadow; - -moz-border-radius: 0px; + border-radius: 0px; margin: 4px; padding: 0px; } diff --git a/browser/themes/gnomestripe/browser/sanitizeDialog.css b/browser/themes/gnomestripe/browser/sanitizeDialog.css index d4b2458a29a0..2cf94d57d30d 100644 --- a/browser/themes/gnomestripe/browser/sanitizeDialog.css +++ b/browser/themes/gnomestripe/browser/sanitizeDialog.css @@ -31,7 +31,7 @@ #sanitizeEverythingWarningBox { background-color: Window; border: 1px solid ThreeDDarkShadow; - -moz-border-radius: 5px; + border-radius: 5px; padding: 16px; } diff --git a/browser/themes/gnomestripe/browser/syncSetup.css b/browser/themes/gnomestripe/browser/syncSetup.css index 32a684c7f8e0..00048ea09ae9 100644 --- a/browser/themes/gnomestripe/browser/syncSetup.css +++ b/browser/themes/gnomestripe/browser/syncSetup.css @@ -53,7 +53,7 @@ wizardpage { .confirm { border: 1px solid black; padding: 1em; - -moz-border-radius: 5px; + border-radius: 5px; } /* Override the text-link style from global.css */ @@ -68,7 +68,7 @@ wizardpage { .success, .error { padding: 2px; - -moz-border-radius: 2px; + border-radius: 2px; } .error { diff --git a/browser/themes/gnomestripe/browser/tabview/tabview.css b/browser/themes/gnomestripe/browser/tabview/tabview.css index 60d2d5d89853..b526a2a75209 100644 --- a/browser/themes/gnomestripe/browser/tabview/tabview.css +++ b/browser/themes/gnomestripe/browser/tabview/tabview.css @@ -19,7 +19,7 @@ body { .tab { padding: 4px 6px 6px 4px; background-color: #D7D7D7; - -moz-border-radius: 0.4em; + border-radius: 0.4em; -moz-box-shadow: 0 1px 0 #FFFFFF inset, 0 -1px 1px rgba(255, 255, 255, 0.4) inset, 1px 0 1px rgba(255, 255, 255, 0.4) inset, @@ -40,7 +40,7 @@ body { .favicon { background-color: #D7D7D7; - -moz-border-radius-bottomright: 0.4em; + border-bottom-right-radius: 0.4em; -moz-box-shadow: 0 -1px 0 rgba(225, 225, 225, 0.8) inset, -1px 0 0 rgba(225, 225, 225, 0.8) inset; @@ -156,7 +156,7 @@ body { cursor: move; border: 1px solid rgba(230,230,230,1); background-color: rgba(248,248,248,1); - -moz-border-radius: 0.4em; + border-radius: 0.4em; -moz-box-shadow: inset rgba(255, 255, 255, 0.6) 0 0 0 2px, rgba(0,0,0,0.2) 1px 1px 4px; @@ -174,7 +174,7 @@ body { .overlay { background-color: rgba(0,0,0,.7) !important; -moz-box-shadow: 3px 3px 8px rgba(0,0,0,.5); - -moz-border-radius: 0.4em; + border-radius: 0.4em; /* border: 1px solid rgba(230,230,230,1); background-color: rgba(248,248,248,1); @@ -190,7 +190,7 @@ body { cursor: move; border: 1px solid rgba(230,230,230,1); background-color: rgba(248,248,248,1); - -moz-border-radius: 0.4em; + border-radius: 0.4em; -moz-box-shadow: inset rgba(255, 255, 255, 0.6) 0 0 0 2px, rgba(0,0,0, .2) 1px 1px 4px; @@ -365,7 +365,7 @@ input.defaultName { color: white; border: none; background-color: #272727; - -moz-border-radius: 0.4em; + border-radius: 0.4em; padding-left:5px; padding-right: 5px; font-size: 14px; } @@ -375,8 +375,8 @@ input.defaultName { height: 30px; background-color: #666; border: none; - -moz-border-radius-bottomleft: 0.4em; - -moz-border-radius-topleft: 0.4em; + border-bottom-left-radius: 0.4em; + border-top-left-radius: 0.4em; -moz-box-shadow: 0px 1px 0px rgba(255,255,255,.5), 0px -1px 0px rgba(0,0,0,.8), inset 6px 6px 13px rgba(0,0,0,.56); opacity: .64; text-align: center; diff --git a/browser/themes/pinstripe/browser/aboutCertError.css b/browser/themes/pinstripe/browser/aboutCertError.css index 7f0df7fe9f63..e0d9e9b9347e 100644 --- a/browser/themes/pinstripe/browser/aboutCertError.css +++ b/browser/themes/pinstripe/browser/aboutCertError.css @@ -67,7 +67,7 @@ h2 { max-width: 52em; margin: 4em auto; border: 1px solid #FFBD09; /* pale yellow extracted from yellow passport icon */ - -moz-border-radius: 10px; + border-radius: 10px; padding: 3em; -moz-padding-start: 30px; background: url("chrome://global/skin/icons/sslWarning.png") left 0 no-repeat -moz-Field; diff --git a/browser/themes/pinstripe/browser/aboutSyncTabs.css b/browser/themes/pinstripe/browser/aboutSyncTabs.css index a2f75766edf1..8795e08ed65f 100644 --- a/browser/themes/pinstripe/browser/aboutSyncTabs.css +++ b/browser/themes/pinstripe/browser/aboutSyncTabs.css @@ -43,7 +43,7 @@ richlistitem[type="tab"] { padding: 2px 5px; margin-bottom: 4px; -moz-margin-start: 4em; - -moz-border-radius: 6px; + border-radius: 6px; background-color: menu; width: 44em; opacity: 0.9; @@ -64,7 +64,7 @@ richlistitem[type="client"] { margin-top: 2px; margin-bottom: 3px; width: 42em; - -moz-border-radius: 6px; + border-radius: 6px; background-color: transparent; -moz-user-focus: ignore !important; } diff --git a/browser/themes/pinstripe/browser/browser.css b/browser/themes/pinstripe/browser/browser.css index 462524c2e9c8..64e290ac5270 100644 --- a/browser/themes/pinstripe/browser/browser.css +++ b/browser/themes/pinstripe/browser/browser.css @@ -165,7 +165,7 @@ toolbarbutton.bookmark-item { font-weight: bold; color: #222; border: 0; - -moz-border-radius: 10000px; + border-radius: 10000px; padding: 0 8px; margin: 0 0 1px; } @@ -298,7 +298,7 @@ toolbarbutton.bookmark-item > menupopup { padding: 0 3px; height: 22px; border: 1px solid @toolbarbuttonBorderColor@; - -moz-border-radius: @toolbarbuttonCornerRadius@; + border-radius: @toolbarbuttonCornerRadius@; -moz-box-shadow: 0 1px rgba(255, 255, 255, 0.2); background: @toolbarbuttonBackground@; background-origin: border-box; @@ -366,14 +366,14 @@ toolbar:not([mode="icons"]) .toolbarbutton-1 > .toolbarbutton-menubutton-dropmar .toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-locale-dir(rtl), .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-locale-dir(ltr) { - -moz-border-radius-topleft: 0; - -moz-border-radius-bottomleft: 0; + border-top-left-radius: 0; + border-bottom-left-radius: 0; } .toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-locale-dir(ltr), .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-locale-dir(rtl) { - -moz-border-radius-topright: 0; - -moz-border-radius-bottomright: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 0; } toolbar:not([mode="icons"]) .toolbarbutton-1:not([open="true"]) > .toolbarbutton-menubutton-dropmarker { @@ -452,7 +452,7 @@ toolbar:not([iconsize="small"])[mode="icons"] #back-button { width: 30px; height: 30px; padding: 4px 5px 4px 3px; - -moz-border-radius: 10000px; + border-radius: 10000px; } toolbar[mode="icons"] #forward-button { @@ -483,15 +483,15 @@ toolbar[iconsize="small"][mode="icons"] #forward-button { toolbar[mode="icons"]:not([iconsize="small"]) #forward-button:-moz-locale-dir(ltr), toolbar[iconsize="small"][mode="icons"] #back-button:-moz-locale-dir(rtl), toolbar[iconsize="small"][mode="icons"] #forward-button:-moz-locale-dir(ltr) { - -moz-border-radius-topleft: 0; - -moz-border-radius-bottomleft: 0; + border-top-left-radius: 0; + border-bottom-left-radius: 0; } toolbar[mode="icons"]:not([iconsize="small"]) #forward-button:-moz-locale-dir(rtl), toolbar[iconsize="small"][mode="icons"] #back-button:-moz-locale-dir(ltr), toolbar[iconsize="small"][mode="icons"] #forward-button:-moz-locale-dir(rtl) { - -moz-border-radius-topright: 0; - -moz-border-radius-bottomright: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 0; } #back-forward-dropmarker { @@ -689,7 +689,7 @@ toolbar[iconsize="small"][mode="icons"] #forward-button:-moz-locale-dir(rtl) { } #urlbar { - -moz-border-radius: @toolbarbuttonCornerRadius@; + border-radius: @toolbarbuttonCornerRadius@; direction: ltr; } @@ -699,7 +699,7 @@ toolbar[iconsize="small"][mode="icons"] #forward-button:-moz-locale-dir(rtl) { #identity-box { margin: 1px; - -moz-border-radius: 2px; + border-radius: 2px; padding: 1px; -moz-box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); text-shadow: 0 1px rgba(255, 255, 255, 0.2); @@ -923,8 +923,8 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- background-origin: border-box; border: none; border-left: 1px solid rgba(0,0,0,.25); - -moz-border-radius-topright: 2px; - -moz-border-radius-bottomright: 2px; + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; } #urlbar > toolbarbutton:active:hover { @@ -1106,7 +1106,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- #editBMPanel_folderMenuList { @hudButton@ - -moz-border-radius: 5px; + border-radius: 5px; margin: 0 3px !important; min-height: 22px; -moz-padding-start: 2px; @@ -1234,7 +1234,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- #editBookmarkPanel .expander-up, #editBookmarkPanel .expander-down { @hudButton@ - -moz-border-radius: 5px; + border-radius: 5px; -moz-margin-start: 4px; -moz-margin-end: 2px; padding: 0; @@ -1282,7 +1282,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- -moz-border-right-colors: #1c1c1c #636363 !important; -moz-border-bottom-colors: #1c1c1c #797979 !important; -moz-border-left-colors: #1c1c1c #636363 !important; - -moz-border-radius: 1px !important; + border-radius: 1px !important; background-color: #666 !important; color: #fff !important; } @@ -1478,7 +1478,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { .tabbrowser-tab, .tabs-newtab-button { -moz-appearance: none; - -moz-border-radius: 0 0 6px 6px; + border-radius: 0 0 6px 6px; color: #222; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4); margin: 0 0 1px; @@ -1499,7 +1499,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { #tabbrowser-tabs[tabsontop="true"] > .tabbrowser-arrowscrollbox > .tabs-newtab-button { border-top-style: solid; border-bottom-style: none; - -moz-border-radius: 6px 6px 0 0; + border-radius: 6px 6px 0 0; padding-top: 0; padding-bottom: 2px; margin-top: 1px; @@ -1697,7 +1697,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { margin: 0; padding: 0; border: none; - -moz-border-radius: 0; + border-radius: 0; background: none; -moz-box-shadow: none; } @@ -2004,7 +2004,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { background: rgba(27%,27%,27%,.9) url(KUI-background.png) repeat-x; color: white; border-style: none; - -moz-border-radius: 20px; + border-radius: 20px; } .KUI-panel[level="top"] { @@ -2060,7 +2060,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { #ctrlTab-showAll:not(:focus) > * > .ctrlTab-preview-inner { padding: 10px; background-color: rgba(255,255,255,.2); - -moz-border-radius: .5em; + border-radius: .5em; } .ctrlTab-preview:focus > * > .ctrlTab-preview-inner { @@ -2069,7 +2069,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { text-shadow: none; padding: 8px; border: 2px solid white; - -moz-border-radius: .5em; + border-radius: .5em; } .ctrlTab-preview:not(#ctrlTab-showAll):focus > * > .ctrlTab-preview-inner { @@ -2109,12 +2109,12 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { height: 20px; padding-bottom: 4px; -moz-padding-start: 4px; - -moz-border-radius-bottomleft: 4px; + border-bottom-left-radius: 4px; } .allTabs-favicon[src]:-moz-locale-dir(rtl) { - -moz-border-radius-bottomleft: 0; - -moz-border-radius-bottomright: 4px; + border-bottom-left-radius: 0; + border-bottom-right-radius: 4px; } .allTabs-preview:not(:focus) > * > .allTabs-favicon-container > .allTabs-favicon[src] { diff --git a/browser/themes/pinstripe/browser/feeds/subscribe.css b/browser/themes/pinstripe/browser/feeds/subscribe.css index 5972726000c2..12805a57ce1c 100644 --- a/browser/themes/pinstripe/browser/feeds/subscribe.css +++ b/browser/themes/pinstripe/browser/feeds/subscribe.css @@ -13,7 +13,7 @@ html { #feedHeader { border: 1px solid ThreeDShadow; - -moz-border-radius: 10px; + border-radius: 10px; padding-top: 4em; padding-bottom: .3em; -moz-padding-start: .3em; diff --git a/browser/themes/pinstripe/browser/inspector.css b/browser/themes/pinstripe/browser/inspector.css index 539a11f2ea44..b8477d2735a8 100644 --- a/browser/themes/pinstripe/browser/inspector.css +++ b/browser/themes/pinstripe/browser/inspector.css @@ -171,7 +171,7 @@ code { .nodeCloseLabel { margin: -2px 2px 0 2px; border: 2px solid transparent; - -moz-border-radius: 3px; + border-radius: 3px; padding: 0 2px; color: #000088; } diff --git a/browser/themes/pinstripe/browser/places/editBookmarkOverlay.css b/browser/themes/pinstripe/browser/places/editBookmarkOverlay.css index 497ea23dda8f..d234ca3a732b 100644 --- a/browser/themes/pinstripe/browser/places/editBookmarkOverlay.css +++ b/browser/themes/pinstripe/browser/places/editBookmarkOverlay.css @@ -121,8 +121,8 @@ -moz-border-right-colors: transparent #FFFFFF #000000; -moz-border-bottom-colors: transparent #FFFFFF #000000; -moz-border-left-colors: transparent #888888 #000000; - -moz-border-radius-topright: 2px; - -moz-border-radius-bottomleft: 2px; + border-top-right-radius: 2px; + border-bottom-left-radius: 2px; padding: 0; background-color: -moz-Field; color: -moz-FieldText; diff --git a/browser/themes/pinstripe/browser/places/organizer.css b/browser/themes/pinstripe/browser/places/organizer.css index 07a90102dc92..5498c35b1aac 100644 --- a/browser/themes/pinstripe/browser/places/organizer.css +++ b/browser/themes/pinstripe/browser/places/organizer.css @@ -88,7 +88,7 @@ margin: 4px 4px 5px; padding: 1px 3px; border: 1px solid @toolbarbuttonBorderColor@; - -moz-border-radius: @toolbarbuttonCornerRadius@; + border-radius: @toolbarbuttonCornerRadius@; -moz-box-shadow: @loweredShadow@; background: @toolbarbuttonBackground@; background-origin: border-box; @@ -133,8 +133,8 @@ #back-button:-moz-locale-dir(ltr), #forward-button:-moz-locale-dir(rtl) { -moz-image-region: rect(0px, 16px, 16px, 0px); - -moz-border-radius-topright: 0; - -moz-border-radius-bottomright: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 0; margin-right: 0; border-right: 0; } @@ -142,8 +142,8 @@ #forward-button:-moz-locale-dir(ltr), #back-button:-moz-locale-dir(rtl) { -moz-image-region: rect(0px, 32px, 16px, 16px); - -moz-border-radius-topleft: 0; - -moz-border-radius-bottomleft: 0; + border-top-left-radius: 0; + border-bottom-left-radius: 0; margin-left: 0; } @@ -283,7 +283,7 @@ font: icon; font-weight: bold; color: #2D2D2D; - -moz-border-radius: 10000px; + border-radius: 10000px; padding: 0 10px 1px; margin: 1px; font-weight: bold; @@ -336,7 +336,7 @@ margin: 0 4px; padding: 0 10px; -moz-appearance: none; - -moz-border-radius: 10000px; + border-radius: 10000px; border: @roundButtonBorder@; text-shadow: @loweredShadow@; background: @roundButtonBackground@; diff --git a/browser/themes/pinstripe/browser/places/places.css b/browser/themes/pinstripe/browser/places/places.css index 5b77f20193b0..978010a5d673 100644 --- a/browser/themes/pinstripe/browser/places/places.css +++ b/browser/themes/pinstripe/browser/places/places.css @@ -67,7 +67,7 @@ #viewButton { -moz-appearance: none; border: 1px solid #7F7F7F; - -moz-border-radius: 10px; + border-radius: 10px; background: @toolbarbuttonBackground@; min-width: 0px; min-height: 0px; diff --git a/browser/themes/pinstripe/browser/sanitizeDialog.css b/browser/themes/pinstripe/browser/sanitizeDialog.css index 63355caab71f..7f936e1d58d9 100644 --- a/browser/themes/pinstripe/browser/sanitizeDialog.css +++ b/browser/themes/pinstripe/browser/sanitizeDialog.css @@ -27,7 +27,7 @@ #sanitizeEverythingWarningBox { background-color: Window; border: 1px solid ThreeDDarkShadow; - -moz-border-radius: 5px; + border-radius: 5px; padding: 16px; } diff --git a/browser/themes/pinstripe/browser/searchbar.css b/browser/themes/pinstripe/browser/searchbar.css index ca51304861bf..076a9034d1be 100644 --- a/browser/themes/pinstripe/browser/searchbar.css +++ b/browser/themes/pinstripe/browser/searchbar.css @@ -1,5 +1,5 @@ .searchbar-textbox { - -moz-border-radius: 10000px; + border-radius: 10000px; } .searchbar-engine-button { diff --git a/browser/themes/pinstripe/browser/shared.inc b/browser/themes/pinstripe/browser/shared.inc index 9008c1f8e2f4..99d23d73d783 100644 --- a/browser/themes/pinstripe/browser/shared.inc +++ b/browser/themes/pinstripe/browser/shared.inc @@ -1,4 +1,4 @@ %include ../../../../toolkit/themes/pinstripe/global/shared.inc %include ../../browserShared.inc -%define hudButton -moz-appearance: none; background: url("chrome://browser/skin/hud-style-button-middle-background.png") repeat-x #464646 center center; border: 3px solid; -moz-border-top-colors: rgba(0,0,0,0.35) rgba(26,26,26,0.5) rgba(255,255,255,0.4); -moz-border-right-colors: rgba(53,53,53,1) rgba(53,53,53,1) rgba(162,162,162,1); -moz-border-bottom-colors: rgba(128,128,128,0.35) rgba(0,0,0,0.5) rgba(255,255,255,0.15); -moz-border-left-colors: rgba(0,0,0,0.35) rgba(26,26,26,0.5) rgba(255,255,255,0.4); -moz-border-radius: 20px; color: #fff; +%define hudButton -moz-appearance: none; background: url("chrome://browser/skin/hud-style-button-middle-background.png") repeat-x #464646 center center; border: 3px solid; -moz-border-top-colors: rgba(0,0,0,0.35) rgba(26,26,26,0.5) rgba(255,255,255,0.4); -moz-border-right-colors: rgba(53,53,53,1) rgba(53,53,53,1) rgba(162,162,162,1); -moz-border-bottom-colors: rgba(128,128,128,0.35) rgba(0,0,0,0.5) rgba(255,255,255,0.15); -moz-border-left-colors: rgba(0,0,0,0.35) rgba(26,26,26,0.5) rgba(255,255,255,0.4); border-radius: 20px; color: #fff; diff --git a/browser/themes/pinstripe/browser/syncSetup.css b/browser/themes/pinstripe/browser/syncSetup.css index 32a684c7f8e0..00048ea09ae9 100644 --- a/browser/themes/pinstripe/browser/syncSetup.css +++ b/browser/themes/pinstripe/browser/syncSetup.css @@ -53,7 +53,7 @@ wizardpage { .confirm { border: 1px solid black; padding: 1em; - -moz-border-radius: 5px; + border-radius: 5px; } /* Override the text-link style from global.css */ @@ -68,7 +68,7 @@ wizardpage { .success, .error { padding: 2px; - -moz-border-radius: 2px; + border-radius: 2px; } .error { diff --git a/browser/themes/pinstripe/browser/tabview/tabview.css b/browser/themes/pinstripe/browser/tabview/tabview.css index 33b85f1ddc15..a9702a9f2675 100644 --- a/browser/themes/pinstripe/browser/tabview/tabview.css +++ b/browser/themes/pinstripe/browser/tabview/tabview.css @@ -20,7 +20,7 @@ body { .tab { padding: 4px 6px 6px 4px; background-color: #D7D7D7; - -moz-border-radius: 0.4em; + border-radius: 0.4em; -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.5); cursor: pointer; @@ -38,7 +38,7 @@ body { .favicon { background-color: #D7D7D7; - -moz-border-radius-bottomright: 0.4em; + border-bottom-right-radius: 0.4em; -moz-box-shadow: 0 -1px 0 rgba(225, 225, 225, 0.8) inset, -1px 0 0 rgba(225, 225, 225, 0.8) inset; @@ -164,7 +164,7 @@ body { .groupItem { cursor: move; background-color: #EBEBEB; - -moz-border-radius: 0.4em; + border-radius: 0.4em; -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 255, 255, 0.5); } @@ -181,7 +181,7 @@ body { .overlay { background-color: rgba(0,0,0,.7) !important; -moz-box-shadow: 3px 3px 8px rgba(0,0,0,.5); - -moz-border-radius: 0.4em; + border-radius: 0.4em; /* border: 1px solid rgba(230,230,230,1); background-color: rgba(248,248,248,1); @@ -197,7 +197,7 @@ body { cursor: move; border: 1px solid rgba(230,230,230,1); background-color: rgba(248,248,248,1); - -moz-border-radius: 0.4em; + border-radius: 0.4em; -moz-box-shadow: inset rgba(255, 255, 255, 0.6) 0 0 0 2px, rgba(0,0,0, .2) 1px 1px 4px; @@ -372,7 +372,7 @@ input.defaultName { color: white; border: none; background-color: #272727; - -moz-border-radius: 0.4em; + border-radius: 0.4em; padding-left:5px; padding-right: 5px; font-size: 14px; } @@ -382,8 +382,8 @@ input.defaultName { height: 30px; background-color: #666; border: none; - -moz-border-radius-bottomleft: 0.4em; - -moz-border-radius-topleft: 0.4em; + border-bottom-left-radius: 0.4em; + border-top-left-radius: 0.4em; -moz-box-shadow: 0px 1px 0px rgba(255,255,255,.5), 0px -1px 0px rgba(0,0,0,.8), inset 6px 6px 13px rgba(0,0,0,.56); opacity: .64; text-align: center; diff --git a/browser/themes/winstripe/browser/aboutCertError.css b/browser/themes/winstripe/browser/aboutCertError.css index 4e034d2e104a..f67a7b9590b0 100644 --- a/browser/themes/winstripe/browser/aboutCertError.css +++ b/browser/themes/winstripe/browser/aboutCertError.css @@ -67,7 +67,7 @@ h2 { max-width: 52em; margin: 4em auto; border: 1px solid #FFBD09; /* pale yellow extracted from yellow passport icon */ - -moz-border-radius: 10px; + border-radius: 10px; padding: 3em; -moz-padding-start: 30px; background: url("chrome://global/skin/icons/sslWarning.png") left 0 no-repeat -moz-Field; diff --git a/browser/themes/winstripe/browser/aboutSyncTabs.css b/browser/themes/winstripe/browser/aboutSyncTabs.css index a2f75766edf1..8795e08ed65f 100644 --- a/browser/themes/winstripe/browser/aboutSyncTabs.css +++ b/browser/themes/winstripe/browser/aboutSyncTabs.css @@ -43,7 +43,7 @@ richlistitem[type="tab"] { padding: 2px 5px; margin-bottom: 4px; -moz-margin-start: 4em; - -moz-border-radius: 6px; + border-radius: 6px; background-color: menu; width: 44em; opacity: 0.9; @@ -64,7 +64,7 @@ richlistitem[type="client"] { margin-top: 2px; margin-bottom: 3px; width: 42em; - -moz-border-radius: 6px; + border-radius: 6px; background-color: transparent; -moz-user-focus: ignore !important; } diff --git a/browser/themes/winstripe/browser/browser-aero.css b/browser/themes/winstripe/browser/browser-aero.css index 4ac6537f3893..cfe8eaeac39d 100644 --- a/browser/themes/winstripe/browser/browser-aero.css +++ b/browser/themes/winstripe/browser/browser-aero.css @@ -111,7 +111,7 @@ #main-menubar:not(:-moz-lwtheme):not(:-moz-window-inactive) { background-color: rgba(255,255,255,.5); - -moz-border-radius: 4px; + border-radius: 4px; } #urlbar, @@ -151,7 +151,7 @@ #ctrlTab-panel { background: transparent; -moz-appearance: -moz-win-glass; - -moz-border-radius: 0; + border-radius: 0; border: none; font: normal 1.2em "Segoe UI"; color: black; diff --git a/browser/themes/winstripe/browser/browser.css b/browser/themes/winstripe/browser/browser.css index 07d884a0c79e..8faa687cb2cd 100644 --- a/browser/themes/winstripe/browser/browser.css +++ b/browser/themes/winstripe/browser/browser.css @@ -116,7 +116,7 @@ statusbarpanel#statusbar-display { -moz-appearance: none; background: -moz-linear-gradient(rgb(247,182,82), rgb(215,98,10) 95%); background-clip: padding-box; - -moz-border-radius: 0 0 4px 4px; + border-radius: 0 0 4px 4px; border: 1px solid rgba(83,42,6,.9); border-top: none; -moz-box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, @@ -147,7 +147,7 @@ statusbarpanel#statusbar-display { #appmenu-button:hover:active, #appmenu-button[open] { background-image: -moz-linear-gradient(rgb(246,170,69), rgb(209,74,0) 95%); - -moz-border-radius: 0; + border-radius: 0; -moz-box-shadow: 0 2px 4px rgba(0,0,0,.4) inset, 0 1px 1px rgba(0,0,0,.2) inset; } @@ -183,7 +183,7 @@ statusbarpanel#statusbar-display { border: 1px solid transparent; padding: 2px; background: transparent; - -moz-border-radius: 3px; + border-radius: 3px; } .appmenu-edit-button[disabled="true"] { @@ -478,7 +478,7 @@ menuitem.bookmark-item { -moz-linear-gradient(rgba(251,252,253,.95), rgba(246,247,248,.47) 49%, rgba(231,232,233,.45) 51%, rgba(225,226,229,.3)); background-clip: padding-box; - -moz-border-radius: 4.5px; + border-radius: 4.5px; border: 1px solid; border-color: rgba(0,0,0,.12) rgba(0,0,0,.19) rgba(0,0,0,.38); -moz-box-shadow: 0 0 0 1px rgba(255,255,255,.3) inset, @@ -523,14 +523,14 @@ toolbar[iconsize="small"][mode="icons"] .toolbarbutton-1 { .toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-locale-dir(ltr), .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-locale-dir(rtl) { - -moz-border-radius-topright: 0; - -moz-border-radius-bottomright: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 0; } .toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-locale-dir(rtl), .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-locale-dir(ltr) { - -moz-border-radius-topleft: 0; - -moz-border-radius-bottomleft: 0; + border-top-left-radius: 0; + border-bottom-left-radius: 0; } .toolbarbutton-1[disabled="true"] { @@ -660,18 +660,18 @@ toolbar[mode="full"] .toolbarbutton-1 > .toolbarbutton-menubutton-button { } #back-button:-moz-locale-dir(ltr) { - -moz-border-radius-topright: 0; - -moz-border-radius-bottomright: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 0; } #back-button:-moz-locale-dir(rtl), #forward-button { - -moz-border-radius-topleft: 0; - -moz-border-radius-bottomleft: 0; + border-top-left-radius: 0; + border-bottom-left-radius: 0; } toolbar:not([iconsize="small"])[mode="icons"] #back-button { - -moz-border-radius: 10000px; + border-radius: 10000px; padding: 0; width: 30px; height: 30px; @@ -922,7 +922,7 @@ toolbar:not([iconsize="small"])[mode="icons"] #forward-button:not([disabled="tru padding: 2px; background-clip: padding-box; border: 1px solid ThreeDDarkShadow; - -moz-border-radius: 4px; + border-radius: 4px; -moz-box-shadow: 0 1px 0 rgba(0,0,0,.1) inset, 0 1px 0 rgba(255,255,255,.4); } @@ -1008,7 +1008,7 @@ toolbar:not([iconsize="small"])[mode="icons"] #forward-button:not([disabled="tru background-color: -moz-dialog; background-image: -moz-linear-gradient(rgba(255,255,255,.25), rgba(0,0,0,.15)); color: -moz-dialogText; - -moz-border-radius: 2px; + border-radius: 2px; } #identity-box:hover { @@ -1205,8 +1205,8 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- background-origin: border-box; border: none; border-left: 1px solid rgba(0,0,0,.25); - -moz-border-radius-topright: 2px; - -moz-border-radius-bottomright: 2px; + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; } #urlbar > toolbarbutton:active:hover { @@ -1391,7 +1391,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- margin: 0; padding: 0; -moz-border-image: url(tabbrowser/tab.png) 4 5 3 6 / 4px 5px 3px 6px; - -moz-border-radius: 10px 8px 0 0; + border-radius: 10px 8px 0 0; } .tabbrowser-tab:hover, @@ -1937,7 +1937,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { background: rgba(27%,27%,27%,.9) url(KUI-background.png) repeat-x; color: white; border-style: none; - -moz-border-radius: 20px; + border-radius: 20px; } .KUI-panel[level="top"] { @@ -1993,7 +1993,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { #ctrlTab-showAll:not(:focus) > * > .ctrlTab-preview-inner { padding: 10px; background-color: rgba(255,255,255,.2); - -moz-border-radius: .5em; + border-radius: .5em; } .ctrlTab-preview:focus > * > .ctrlTab-preview-inner { @@ -2002,7 +2002,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { text-shadow: none; padding: 8px; border: 2px solid white; - -moz-border-radius: .5em; + border-radius: .5em; } .ctrlTab-preview:not(#ctrlTab-showAll):focus > * > .ctrlTab-preview-inner { @@ -2046,12 +2046,12 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { -moz-padding-end: 5px; margin-top: -2px; -moz-margin-start: -2px; - -moz-border-radius-bottomright: 4px; + border-bottom-right-radius: 4px; } .allTabs-favicon[src]:-moz-locale-dir(rtl) { - -moz-border-radius-bottomright: 0; - -moz-border-radius-bottomleft: 4px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 4px; } .allTabs-preview-inner > .tabPreview-canvas { diff --git a/browser/themes/winstripe/browser/feeds/subscribe.css b/browser/themes/winstripe/browser/feeds/subscribe.css index b9afde6e0eac..932903ef0d21 100644 --- a/browser/themes/winstripe/browser/feeds/subscribe.css +++ b/browser/themes/winstripe/browser/feeds/subscribe.css @@ -13,7 +13,7 @@ html { #feedHeaderContainer { border: 1px solid ThreeDShadow; - -moz-border-radius: 10px; + border-radius: 10px; margin: -4em auto 0 auto; background-color: InfoBackground; } diff --git a/browser/themes/winstripe/browser/inspector.css b/browser/themes/winstripe/browser/inspector.css index f04bd6c86654..f27c1aee7477 100644 --- a/browser/themes/winstripe/browser/inspector.css +++ b/browser/themes/winstripe/browser/inspector.css @@ -170,7 +170,7 @@ code { .nodeCloseLabel { margin: -2px 2px 0 2px; border: 2px solid transparent; - -moz-border-radius: 3px; + border-radius: 3px; padding: 0 2px; color: #000088; } diff --git a/browser/themes/winstripe/browser/places/organizer.css b/browser/themes/winstripe/browser/places/organizer.css index 919f8856e400..f214ca78efc4 100644 --- a/browser/themes/winstripe/browser/places/organizer.css +++ b/browser/themes/winstripe/browser/places/organizer.css @@ -185,7 +185,7 @@ #organizerScopeBar > toolbarbutton { -moz-appearance: none; border: 1px solid transparent; - -moz-border-radius: 2px; + border-radius: 2px; padding: 0 !important; margin: 0 1px; } diff --git a/browser/themes/winstripe/browser/preferences/preferences.css b/browser/themes/winstripe/browser/preferences/preferences.css index 5f3c966fe130..edb779409de9 100644 --- a/browser/themes/winstripe/browser/preferences/preferences.css +++ b/browser/themes/winstripe/browser/preferences/preferences.css @@ -160,7 +160,7 @@ radio[pane=paneSync] { #cookieInfoBox { border: 1px solid ThreeDShadow; - -moz-border-radius: 0; + border-radius: 0; margin: 4px; padding: 0; } diff --git a/browser/themes/winstripe/browser/sanitizeDialog.css b/browser/themes/winstripe/browser/sanitizeDialog.css index fbb39a770179..9b80d83ba364 100644 --- a/browser/themes/winstripe/browser/sanitizeDialog.css +++ b/browser/themes/winstripe/browser/sanitizeDialog.css @@ -31,7 +31,7 @@ #sanitizeEverythingWarningBox { background-color: Window; border: 1px solid ThreeDDarkShadow; - -moz-border-radius: 5px; + border-radius: 5px; padding: 16px; } diff --git a/browser/themes/winstripe/browser/syncSetup.css b/browser/themes/winstripe/browser/syncSetup.css index 32a684c7f8e0..00048ea09ae9 100644 --- a/browser/themes/winstripe/browser/syncSetup.css +++ b/browser/themes/winstripe/browser/syncSetup.css @@ -53,7 +53,7 @@ wizardpage { .confirm { border: 1px solid black; padding: 1em; - -moz-border-radius: 5px; + border-radius: 5px; } /* Override the text-link style from global.css */ @@ -68,7 +68,7 @@ wizardpage { .success, .error { padding: 2px; - -moz-border-radius: 2px; + border-radius: 2px; } .error { diff --git a/browser/themes/winstripe/browser/tabview/tabview.css b/browser/themes/winstripe/browser/tabview/tabview.css index ae7a0ef09980..6ca1983e8c02 100644 --- a/browser/themes/winstripe/browser/tabview/tabview.css +++ b/browser/themes/winstripe/browser/tabview/tabview.css @@ -19,7 +19,7 @@ body { .tab { padding: 4px 6px 6px 4px; background-color: #E0EAF5; - -moz-border-radius: 0.4em; + border-radius: 0.4em; -moz-box-shadow: 0 1px 0 #FFFFFF inset, 0 -1px 1px rgba(255, 255, 255, 0.8) inset, @@ -41,7 +41,7 @@ body { .favicon { background-color: #E0EAF5; - -moz-border-radius-bottomright: 0.4em; + border-bottom-right-radius: 0.4em; padding: 4px 6px 6px 4px; top: 4px; left: 4px; @@ -166,7 +166,7 @@ body { .groupItem { cursor: move; background-color: #E0EAF5; - -moz-border-radius: 0.4em; + border-radius: 0.4em; -moz-box-shadow: 0 1px 0 #FFFFFF inset, 0 -1px 1px rgba(255, 255, 255, 0.8) inset, @@ -186,7 +186,7 @@ body { .overlay { background-color: rgba(0,0,0,.7) !important; -moz-box-shadow: 3px 3px 8px rgba(0,0,0,.5); - -moz-border-radius: 0.4em; + border-radius: 0.4em; /* border: 1px solid rgba(230,230,230,1); background-color: rgba(248,248,248,1); @@ -202,7 +202,7 @@ body { cursor: move; border: 1px solid rgba(230,230,230,1); background-color: rgba(248,248,248,1); - -moz-border-radius: 0.4em; + border-radius: 0.4em; -moz-box-shadow: inset rgba(255, 255, 255, 0.6) 0 0 0 2px, rgba(0,0,0, .2) 1px 1px 4px; @@ -377,7 +377,7 @@ input.defaultName { color: white; border: none; background-color: #272727; - -moz-border-radius: 0.4em; + border-radius: 0.4em; padding-left:5px; padding-right: 5px; font-size: 14px; } @@ -387,8 +387,8 @@ input.defaultName { height: 30px; background-color: #CFDBE8; border: none; - -moz-border-radius-bottomleft: 0.4em; - -moz-border-radius-topleft: 0.4em; + border-bottom-left-radius: 0.4em; + border-top-left-radius: 0.4em; -moz-box-shadow: 0px 1px 0px rgba(255,255,255,.5), 0px -1px 0px rgba(0,0,0,.8), inset 6px 6px 13px rgba(0,0,0,.56); opacity: .64; text-align: center; diff --git a/layout/base/crashtests/265736-2.html b/layout/base/crashtests/265736-2.html index a088aed4689e..2e5041b2dd6f 100644 --- a/layout/base/crashtests/265736-2.html +++ b/layout/base/crashtests/265736-2.html @@ -3,6 +3,6 @@ - + + + + + + + + +
+
+
+
+
+
+
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+ + diff --git a/content/html/content/test/test_bug583288-2.html b/content/html/content/test/test_bug583288-2.html new file mode 100644 index 000000000000..d7a0592c6823 --- /dev/null +++ b/content/html/content/test/test_bug583288-2.html @@ -0,0 +1,99 @@ + + + + + Test for Bug 583288 + + + + + + +Mozilla Bug 583288 +

+ + +
+ + + + + +
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/content/html/content/test/test_bug583288-3.html b/content/html/content/test/test_bug583288-3.html new file mode 100644 index 000000000000..f9779d7c71a7 --- /dev/null +++ b/content/html/content/test/test_bug583288-3.html @@ -0,0 +1,85 @@ + + + + + Test for Bug 583288 + + + + + + +Mozilla Bug 583288 +

+ + +
+ + + + + +
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/content/html/content/test/test_bug585508.html b/content/html/content/test/test_bug585508.html index adf3c9bc5c49..7d5eac307bcf 100644 --- a/content/html/content/test/test_bug585508.html +++ b/content/html/content/test/test_bug585508.html @@ -30,11 +30,9 @@ var methodTestData = [ // Default value. [ "get" ], // Valid values. - [ "get", "post" ], + [ "get", "post", "put", "delete" ], // Invalid values. [ "", " ", "foo" ], - // TODO values, see bug 583289 and bug 583288. - [ "delete", "put" ], ]; function checkAttribute(form, attrName, idlName, data) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index c49ea13dcc2d..3570009af1b0 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -1412,7 +1412,8 @@ nsDocShell::LoadURI(nsIURI * aURI, nsnull, // No SHEntry aFirstParty, nsnull, // No nsIDocShell - nsnull); // No nsIRequest + nsnull, // No nsIRequest + nsnull); // Use default HTTP method } NS_IMETHODIMP @@ -4095,7 +4096,7 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL, return InternalLoad(errorPageURI, nsnull, nsnull, INTERNAL_LOAD_FLAGS_INHERIT_OWNER, nsnull, nsnull, nsnull, nsnull, LOAD_ERROR_PAGE, - nsnull, PR_TRUE, nsnull, nsnull); + nsnull, PR_TRUE, nsnull, nsnull, nsnull); } @@ -4159,7 +4160,8 @@ nsDocShell::Reload(PRUint32 aReloadFlags) nsnull, // No SHEntry PR_TRUE, nsnull, // No nsIDocShell - nsnull); // No nsIRequest + nsnull, // No nsIRequest + nsnull); // Use default HTTP method } @@ -5869,7 +5871,7 @@ nsDocShell::OnLocationChange(nsIWebProgress * aProgress, return NS_OK; } -void +nsresult nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel, nsIChannel* aNewChannel, PRUint32 aRedirectFlags, @@ -5878,13 +5880,44 @@ nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel, NS_ASSERTION(aStateFlags & STATE_REDIRECTING, "Calling OnRedirectStateChange when there is no redirect"); if (!(aStateFlags & STATE_IS_DOCUMENT)) - return; // not a toplevel document + return NS_OK; // not a toplevel document nsCOMPtr oldURI, newURI; aOldChannel->GetURI(getter_AddRefs(oldURI)); aNewChannel->GetURI(getter_AddRefs(newURI)); if (!oldURI || !newURI) { - return; + return NS_OK; + } + + // HTTP channel with unsafe methods should not be redirected to a cross-domain. + if (!ChannelIsSafeMethod(aNewChannel)) { + // This code is very similar to the code of nsSameOriginChecker in + // nsContentUtils but we can't use nsSameOriginChecker because it + // needs to use a channel callback (which we already use). + // If nsSameOriginChecker happens to not use a channel callback + // anymore, this code would be a good candidate for refactoring. + nsCOMPtr oldPrincipal; + nsresult rv; + + nsCOMPtr secMan = + do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); + + rv = secMan->GetChannelPrincipal(aOldChannel, + getter_AddRefs(oldPrincipal)); + NS_ENSURE_SUCCESS(rv, NS_OK); + + NS_ASSERTION(oldPrincipal, "oldPrincipal should not be null!"); + + nsCOMPtr newOriginalURI; + aNewChannel->GetOriginalURI(getter_AddRefs(newOriginalURI)); + + rv = oldPrincipal->CheckMayLoad(newURI, PR_FALSE); + if (NS_SUCCEEDED(rv) && newOriginalURI != newURI) { + rv = oldPrincipal->CheckMayLoad(newOriginalURI, PR_FALSE); + } + + // The requested tried to be redirected, we have to cancel it. + NS_ENSURE_SUCCESS(rv, rv); } // Below a URI visit is saved (see AddURIVisit method doc). @@ -5935,6 +5968,8 @@ nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel, mLoadType = LOAD_NORMAL_REPLACE; SetHistoryEntry(&mLSHE, nsnull); } + + return NS_OK; } NS_IMETHODIMP @@ -6306,7 +6341,8 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress, nsnull, // No SHEntry PR_TRUE, // first party site nsnull, // No nsIDocShell - nsnull); // No nsIRequest + nsnull, // No nsIRequest + nsnull); // Use default HTTP method } else { DisplayLoadError(aStatus, url, nsnull, aChannel); @@ -7750,7 +7786,7 @@ public: return mDocShell->InternalLoad(mURI, mReferrer, mOwner, mFlags, nsnull, mTypeHint.get(), mPostData, mHeadersData, mLoadType, - mSHEntry, mFirstParty, nsnull, nsnull); + mSHEntry, mFirstParty, nsnull, nsnull, nsnull); } private: @@ -7784,7 +7820,8 @@ nsDocShell::InternalLoad(nsIURI * aURI, nsISHEntry * aSHEntry, PRBool aFirstParty, nsIDocShell** aDocShell, - nsIRequest** aRequest) + nsIRequest** aRequest, + const char* aHttpMethod) { nsresult rv = NS_OK; @@ -7986,7 +8023,8 @@ nsDocShell::InternalLoad(nsIURI * aURI, aSHEntry, aFirstParty, aDocShell, - aRequest); + aRequest, + aHttpMethod); if (rv == NS_ERROR_NO_CONTENT) { // XXXbz except we never reach this code! if (isNewWindow) { @@ -8421,7 +8459,8 @@ nsDocShell::InternalLoad(nsIURI * aURI, aDocShell, getter_AddRefs(req), (aFlags & INTERNAL_LOAD_FLAGS_FIRST_LOAD) != 0, (aFlags & INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER) != 0, - (aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES) != 0); + (aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES) != 0, + aHttpMethod); if (req && aRequest) NS_ADDREF(*aRequest = req); @@ -8502,7 +8541,8 @@ nsDocShell::DoURILoad(nsIURI * aURI, nsIRequest ** aRequest, PRBool aIsNewWindowTarget, PRBool aBypassClassifier, - PRBool aForceAllowCookies) + PRBool aForceAllowCookies, + const char* aHttpMethod) { nsresult rv; nsCOMPtr uriLoader; @@ -8685,6 +8725,20 @@ nsDocShell::DoURILoad(nsIURI * aURI, // Referrer is currenly only set for link clicks here. httpChannel->SetReferrer(aReferrerURI); } + + // If a specific HTTP method has been requested, set it. + if (aHttpMethod) { + // Tell the cache it _has_ to open a cache entry. + PRUint32 loadFlags; + if (NS_SUCCEEDED(channel->GetLoadFlags(&loadFlags))) { + channel->SetLoadFlags(loadFlags | nsICachingChannel::FORCE_OPEN_CACHE_ENTRY); + } + + // The method name have to be correct. + // Otherwise SetRequestMethod will return a failure. + rv = httpChannel->SetRequestMethod(nsDependentCString(aHttpMethod)); + NS_ENSURE_SUCCESS(rv, rv); + } } // // Set the owner of the channel, but only for channels that can't @@ -8735,6 +8789,14 @@ nsDocShell::DoURILoad(nsIURI * aURI, } } + // If a specific HTTP channel has been set and it is not a safe method, + // we should prevent cross-origin requests. + if (aHttpMethod && ownerPrincipal && !ChannelIsSafeMethod(channel)) { + if (NS_FAILED(ownerPrincipal->CheckMayLoad(aURI, PR_FALSE))) { + return NS_OK; + } + } + nsCOMPtr scriptChannel = do_QueryInterface(channel); if (scriptChannel) { // Allow execution against our context if the principals match @@ -9946,7 +10008,8 @@ nsDocShell::LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType) aEntry, // SHEntry PR_TRUE, nsnull, // No nsIDocShell - nsnull); // No nsIRequest + nsnull, // No nsIRequest + nsnull); // Use default HTTP method return rv; } @@ -10359,6 +10422,7 @@ NS_IMETHODIMP nsDocShell::MakeEditable(PRBool inWaitForUriLoad) return mEditorData->MakeEditable(inWaitForUriLoad); } +/* static */ bool nsDocShell::ChannelIsPost(nsIChannel* aChannel) { @@ -10372,6 +10436,21 @@ nsDocShell::ChannelIsPost(nsIChannel* aChannel) return method.Equals("POST"); } +/* static */ +bool +nsDocShell::ChannelIsSafeMethod(nsIChannel* aChannel) +{ + nsCOMPtr httpChannel(do_QueryInterface(aChannel)); + if (!httpChannel) { + return false; + } + + nsCAutoString method; + httpChannel->GetRequestMethod(method); + return method.Equals("GET") || method.Equals("POST") || + method.Equals("HEAD"); +} + void nsDocShell::ExtractLastVisit(nsIChannel* aChannel, nsIURI** aURI, @@ -11302,7 +11381,8 @@ nsDocShell::OnLinkClickSync(nsIContent *aContent, nsIInputStream* aPostDataStream, nsIInputStream* aHeadersDataStream, nsIDocShell** aDocShell, - nsIRequest** aRequest) + nsIRequest** aRequest, + const char* aHttpMethod) { // Initialize the DocShell / Request if (aDocShell) { @@ -11378,7 +11458,8 @@ nsDocShell::OnLinkClickSync(nsIContent *aContent, nsnull, // No SHEntry PR_TRUE, // first party site aDocShell, // DocShell out-param - aRequest); // Request out-param + aRequest, // Request out-param + aHttpMethod); // HTTP Method if (NS_SUCCEEDED(rv)) { DispatchPings(aContent, referer); } diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 2e95717263ac..80e2a5c2d5ec 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -243,7 +243,8 @@ public: nsIInputStream* aPostDataStream = 0, nsIInputStream* aHeadersDataStream = 0, nsIDocShell** aDocShell = 0, - nsIRequest** aRequest = 0); + nsIRequest** aRequest = 0, + const char* aHttpMethod = 0); NS_IMETHOD OnOverLink(nsIContent* aContent, nsIURI* aURI, const PRUnichar* aTargetSpec); @@ -325,7 +326,8 @@ protected: nsIRequest ** aRequest, PRBool aIsNewWindowTarget, PRBool aBypassClassifier, - PRBool aForceAllowCookies); + PRBool aForceAllowCookies, + const char* aHttpMethod); NS_IMETHOD AddHeadersToChannel(nsIInputStream * aHeadersData, nsIChannel * aChannel); virtual nsresult DoChannelLoad(nsIChannel * aChannel, @@ -434,10 +436,10 @@ protected: // overridden from nsDocLoader, this provides more information than the // normal OnStateChange with flags STATE_REDIRECTING - virtual void OnRedirectStateChange(nsIChannel* aOldChannel, - nsIChannel* aNewChannel, - PRUint32 aRedirectFlags, - PRUint32 aStateFlags); + virtual nsresult OnRedirectStateChange(nsIChannel* aOldChannel, + nsIChannel* aNewChannel, + PRUint32 aRedirectFlags, + PRUint32 aStateFlags); /** * Helper function that determines if channel is an HTTP POST. @@ -447,7 +449,17 @@ protected: * * @return True iff channel is an HTTP post. */ - bool ChannelIsPost(nsIChannel* aChannel); + static bool ChannelIsPost(nsIChannel* aChannel); + + /** + * Helper function that determines if the HTTP channel has a safe method + * + * @param aChannel The channel to test + * + * @return Whether the channel has a safe HTTP method. + * @note Will return false if the channel isn't an HTTP channel. + */ + static bool ChannelIsSafeMethod(nsIChannel* aChannel); /** * Helper function that finds the last URI and its transition flags for a diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index 1cb5ff4e7d91..93aee1996abc 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -71,7 +71,7 @@ interface nsIPrincipal; interface nsIWebBrowserPrint; interface nsIVariant; -[scriptable, uuid(74470127-87eb-4f79-8293-1616fe9cb689)] +[scriptable, uuid(0e1e1ee5-5baa-4e27-98af-3197d70d0304)] interface nsIDocShell : nsISupports { /** @@ -155,6 +155,10 @@ interface nsIDocShell : nsISupports * @param aLoadFlags - Flags to modify load behaviour. Flags are defined * in nsIWebNavigation. * @param aSHEntry - Active Session History entry (if loading from SH) + * @param firstParty - + * @param aDocShell - + * @param aRequest - + * @param aHttpMethod - Force the HTTP channel to use a specific HTTP method */ [noscript]void internalLoad(in nsIURI aURI, in nsIURI aReferrer, @@ -168,7 +172,8 @@ interface nsIDocShell : nsISupports in nsISHEntry aSHEntry, in boolean firstParty, out nsIDocShell aDocShell, - out nsIRequest aRequest); + out nsIRequest aRequest, + in string aHttpMethod); /** * Do either a history.pushState() or history.replaceState() operation, diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp index 78e4d9b1c76b..0dc8331b8267 100644 --- a/uriloader/base/nsDocLoader.cpp +++ b/uriloader/base/nsDocLoader.cpp @@ -1609,7 +1609,9 @@ NS_IMETHODIMP nsDocLoader::AsyncOnChannelRedirect(nsIChannel *aOldChannel, #endif /* DEBUG */ } - OnRedirectStateChange(aOldChannel, aNewChannel, aFlags, stateFlags); + nsresult rv = OnRedirectStateChange(aOldChannel, aNewChannel, aFlags, + stateFlags); + NS_ENSURE_SUCCESS(rv, rv); FireOnStateChange(this, aOldChannel, stateFlags, NS_OK); } diff --git a/uriloader/base/nsDocLoader.h b/uriloader/base/nsDocLoader.h index 1f5b189cc94c..51c5828253ea 100644 --- a/uriloader/base/nsDocLoader.h +++ b/uriloader/base/nsDocLoader.h @@ -69,11 +69,11 @@ struct nsListenerInfo; ****************************************************************************/ #define NS_THIS_DOCLOADER_IMPL_CID \ - { /* b4ec8387-98aa-4c08-93b6-6d23069c06f2 */ \ - 0xb4ec8387, \ - 0x98aa, \ - 0x4c08, \ - {0x93, 0xb6, 0x6d, 0x23, 0x06, 0x9c, 0x06, 0xf2} \ + { \ + 0x306cae1f, \ + 0x90ee, \ + 0x4e51, \ + {0xaf, 0x27, 0x9c, 0x13, 0xde, 0xba, 0x91, 0xb6} \ } class nsDocLoader : public nsIDocumentLoader, @@ -179,10 +179,12 @@ protected: // @param aRedirectFlags The flags being sent to OnStateChange that // indicate the type of redirect. // @param aStateFlags The channel flags normally sent to OnStateChange. - virtual void OnRedirectStateChange(nsIChannel* aOldChannel, - nsIChannel* aNewChannel, - PRUint32 aRedirectFlags, - PRUint32 aStateFlags) {} + // + // @return Something else than NS_OK if the redirection should be cancelled. + virtual nsresult OnRedirectStateChange(nsIChannel* aOldChannel, + nsIChannel* aNewChannel, + PRUint32 aRedirectFlags, + PRUint32 aStateFlags) { return NS_OK; } void doStartDocumentLoad(); void doStartURLLoad(nsIRequest *request); diff --git a/webshell/public/nsILinkHandler.h b/webshell/public/nsILinkHandler.h index 4b62d4ccc6dd..f3d28a0bc2d3 100644 --- a/webshell/public/nsILinkHandler.h +++ b/webshell/public/nsILinkHandler.h @@ -48,7 +48,7 @@ class nsGUIEvent; // Interface ID for nsILinkHandler #define NS_ILINKHANDLER_IID \ - { 0x71627c30, 0xd3c5, 0x4ad0,{0xb5, 0x33, 0x6e, 0x01, 0x91, 0xf2, 0x79, 0x32}} + { 0x1fa72627, 0x646b, 0x4573,{0xb5, 0xc8, 0xb4, 0x65, 0xc6, 0x78, 0xd4, 0x9d}} /** * Interface used for handling clicks on links @@ -87,6 +87,7 @@ public: * @param aHeadersDataStream ??? * @param aDocShell (out-param) the DocShell that the request was opened on * @param aRequest the request that was opened + * @param aHttpMethod forces the http channel to use a specific method */ NS_IMETHOD OnLinkClickSync(nsIContent* aContent, nsIURI* aURI, @@ -94,7 +95,8 @@ public: nsIInputStream* aPostDataStream = 0, nsIInputStream* aHeadersDataStream = 0, nsIDocShell** aDocShell = 0, - nsIRequest** aRequest = 0) = 0; + nsIRequest** aRequest = 0, + const char* aHttpMethod = 0) = 0; /** * Process a mouse-over a link. From a1d45586a075672a021a1063faa6337463914c12 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Fri, 10 Sep 2010 07:04:30 +0200 Subject: [PATCH 109/176] Bug 594952 - Fix compilation of SVGDocumentWrapper.cpp when SMIL is disabled. r=dholbert a2.0=bustage --- modules/libpr0n/src/SVGDocumentWrapper.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/libpr0n/src/SVGDocumentWrapper.cpp b/modules/libpr0n/src/SVGDocumentWrapper.cpp index 2d8ec48941b0..cca1dbb528d1 100644 --- a/modules/libpr0n/src/SVGDocumentWrapper.cpp +++ b/modules/libpr0n/src/SVGDocumentWrapper.cpp @@ -163,9 +163,13 @@ SVGDocumentWrapper::UpdateViewportBounds(const nsIntSize& aViewportSize) PRBool SVGDocumentWrapper::IsAnimated() { +#ifdef MOZ_SMIL nsIDocument* doc = mViewer->GetDocument(); return doc && doc->HasAnimationController() && doc->GetAnimationController()->HasRegisteredAnimations(); +#else + return PR_FALSE; +#endif // MOZ_SMIL } void From 795e4b9f4ec681137ded21d47c368edc1fa07f3b Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Fri, 10 Sep 2010 07:08:56 +0200 Subject: [PATCH 110/176] Bug 580575 - Implement :-moz-submit-invalid pseudo-class applying on submit buttons when the form is invalid. r=bz sr=sicking a2.0=roc --- content/events/public/nsIEventStateManager.h | 12 +++ .../content/public/nsIConstraintValidation.h | 21 ++--- .../html/content/src/nsHTMLButtonElement.cpp | 39 ++++++--- .../content/src/nsHTMLFieldSetElement.cpp | 5 +- .../html/content/src/nsHTMLFormElement.cpp | 86 ++++++++++++++++++- content/html/content/src/nsHTMLFormElement.h | 36 ++++++++ .../html/content/src/nsHTMLInputElement.cpp | 30 +++++-- content/html/content/src/nsHTMLInputElement.h | 2 +- .../html/content/src/nsHTMLObjectElement.cpp | 6 +- .../html/content/src/nsHTMLOutputElement.cpp | 5 +- .../html/content/src/nsHTMLSelectElement.cpp | 20 +++++ .../html/content/src/nsHTMLSelectElement.h | 2 + .../content/src/nsHTMLTextAreaElement.cpp | 20 +++-- .../content/src/nsIConstraintValidation.cpp | 68 ++++++++++----- .../button-submit/add-invalid-element.html | 21 +++++ .../button-submit/add-submit-control.html | 21 +++++ .../change-type-not-submit-control.html | 21 +++++ .../change-type-submit-control.html | 21 +++++ .../dynamic-invalid-barred-2.html | 21 +++++ .../button-submit/dynamic-invalid-barred.html | 21 +++++ .../dynamic-invalid-not-barred.html | 21 +++++ .../button-submit/dynamic-invalid.html | 21 +++++ .../button-submit/dynamic-valid.html | 21 +++++ .../button-submit/invalid-barred-ref.html | 9 ++ .../button-submit/invalid-ref-2.html | 8 ++ .../button-submit/invalid-ref-3.html | 11 +++ .../button-submit/invalid-ref.html | 8 ++ .../button-submit/reftest.list | 16 ++++ .../button-submit/remove-form.html | 23 +++++ .../button-submit/remove-invalid-element.html | 21 +++++ .../button-submit/remove-submit-control.html | 21 +++++ .../button-submit/self-invalid.html | 20 +++++ .../button-submit/static-invalid-barred.html | 14 +++ .../button-submit/static-invalid.html | 14 +++ .../button-submit/static-valid.html | 14 +++ .../button-submit/valid-ref-2.html | 8 ++ .../button-submit/valid-ref-3.html | 9 ++ .../button-submit/valid-ref-4.html | 9 ++ .../button-submit/valid-ref.html | 9 ++ .../input-image/add-invalid-element.html | 21 +++++ .../input-image/add-submit-control.html | 21 +++++ .../change-type-not-submit-control.html | 21 +++++ .../change-type-submit-control.html | 21 +++++ .../input-image/dynamic-invalid-barred-2.html | 21 +++++ .../input-image/dynamic-invalid-barred.html | 21 +++++ .../dynamic-invalid-not-barred.html | 21 +++++ .../input-image/dynamic-invalid.html | 21 +++++ .../input-image/dynamic-valid.html | 21 +++++ .../input-image/invalid-barred-ref.html | 9 ++ .../input-image/invalid-ref-2.html | 8 ++ .../input-image/invalid-ref-3.html | 11 +++ .../input-image/invalid-ref.html | 8 ++ .../input-image/reftest.list | 16 ++++ .../input-image/remove-form.html | 23 +++++ .../input-image/remove-invalid-element.html | 21 +++++ .../input-image/remove-submit-control.html | 21 +++++ .../input-image/self-invalid.html | 20 +++++ .../input-image/static-invalid-barred.html | 14 +++ .../input-image/static-invalid.html | 14 +++ .../input-image/static-valid.html | 14 +++ .../input-image/valid-ref-2.html | 8 ++ .../input-image/valid-ref-3.html | 9 ++ .../input-image/valid-ref-4.html | 9 ++ .../input-image/valid-ref.html | 9 ++ .../input-submit/add-invalid-element.html | 21 +++++ .../input-submit/add-submit-control.html | 21 +++++ .../change-type-not-submit-control.html | 21 +++++ .../change-type-submit-control.html | 21 +++++ .../dynamic-invalid-barred-2.html | 21 +++++ .../input-submit/dynamic-invalid-barred.html | 21 +++++ .../dynamic-invalid-not-barred.html | 21 +++++ .../input-submit/dynamic-invalid.html | 21 +++++ .../input-submit/dynamic-valid.html | 21 +++++ .../input-submit/invalid-barred-ref.html | 9 ++ .../input-submit/invalid-ref-2.html | 8 ++ .../input-submit/invalid-ref-3.html | 11 +++ .../input-submit/invalid-ref.html | 8 ++ .../input-submit/reftest.list | 16 ++++ .../input-submit/remove-form.html | 23 +++++ .../input-submit/remove-invalid-element.html | 21 +++++ .../input-submit/remove-submit-control.html | 21 +++++ .../input-submit/self-invalid.html | 20 +++++ .../input-submit/static-invalid-barred.html | 14 +++ .../input-submit/static-invalid.html | 14 +++ .../input-submit/static-valid.html | 14 +++ .../input-submit/valid-ref-2.html | 8 ++ .../input-submit/valid-ref-3.html | 9 ++ .../input-submit/valid-ref-4.html | 9 ++ .../input-submit/valid-ref.html | 9 ++ .../reftests/css-submit-invalid/reftest.list | 3 + layout/reftests/reftest.list | 3 + layout/style/nsCSSPseudoClassList.h | 2 + 92 files changed, 1503 insertions(+), 66 deletions(-) create mode 100644 layout/reftests/css-submit-invalid/button-submit/add-invalid-element.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/add-submit-control.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/change-type-not-submit-control.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/change-type-submit-control.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/dynamic-invalid-barred-2.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/dynamic-invalid-barred.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/dynamic-invalid-not-barred.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/dynamic-invalid.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/dynamic-valid.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/invalid-barred-ref.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/invalid-ref-2.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/invalid-ref-3.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/invalid-ref.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/reftest.list create mode 100644 layout/reftests/css-submit-invalid/button-submit/remove-form.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/remove-invalid-element.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/remove-submit-control.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/self-invalid.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/static-invalid-barred.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/static-invalid.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/static-valid.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/valid-ref-2.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/valid-ref-3.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/valid-ref-4.html create mode 100644 layout/reftests/css-submit-invalid/button-submit/valid-ref.html create mode 100644 layout/reftests/css-submit-invalid/input-image/add-invalid-element.html create mode 100644 layout/reftests/css-submit-invalid/input-image/add-submit-control.html create mode 100644 layout/reftests/css-submit-invalid/input-image/change-type-not-submit-control.html create mode 100644 layout/reftests/css-submit-invalid/input-image/change-type-submit-control.html create mode 100644 layout/reftests/css-submit-invalid/input-image/dynamic-invalid-barred-2.html create mode 100644 layout/reftests/css-submit-invalid/input-image/dynamic-invalid-barred.html create mode 100644 layout/reftests/css-submit-invalid/input-image/dynamic-invalid-not-barred.html create mode 100644 layout/reftests/css-submit-invalid/input-image/dynamic-invalid.html create mode 100644 layout/reftests/css-submit-invalid/input-image/dynamic-valid.html create mode 100644 layout/reftests/css-submit-invalid/input-image/invalid-barred-ref.html create mode 100644 layout/reftests/css-submit-invalid/input-image/invalid-ref-2.html create mode 100644 layout/reftests/css-submit-invalid/input-image/invalid-ref-3.html create mode 100644 layout/reftests/css-submit-invalid/input-image/invalid-ref.html create mode 100644 layout/reftests/css-submit-invalid/input-image/reftest.list create mode 100644 layout/reftests/css-submit-invalid/input-image/remove-form.html create mode 100644 layout/reftests/css-submit-invalid/input-image/remove-invalid-element.html create mode 100644 layout/reftests/css-submit-invalid/input-image/remove-submit-control.html create mode 100644 layout/reftests/css-submit-invalid/input-image/self-invalid.html create mode 100644 layout/reftests/css-submit-invalid/input-image/static-invalid-barred.html create mode 100644 layout/reftests/css-submit-invalid/input-image/static-invalid.html create mode 100644 layout/reftests/css-submit-invalid/input-image/static-valid.html create mode 100644 layout/reftests/css-submit-invalid/input-image/valid-ref-2.html create mode 100644 layout/reftests/css-submit-invalid/input-image/valid-ref-3.html create mode 100644 layout/reftests/css-submit-invalid/input-image/valid-ref-4.html create mode 100644 layout/reftests/css-submit-invalid/input-image/valid-ref.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/add-invalid-element.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/add-submit-control.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/change-type-not-submit-control.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/change-type-submit-control.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/dynamic-invalid-barred-2.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/dynamic-invalid-barred.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/dynamic-invalid-not-barred.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/dynamic-invalid.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/dynamic-valid.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/invalid-barred-ref.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/invalid-ref-2.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/invalid-ref-3.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/invalid-ref.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/reftest.list create mode 100644 layout/reftests/css-submit-invalid/input-submit/remove-form.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/remove-invalid-element.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/remove-submit-control.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/self-invalid.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/static-invalid-barred.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/static-invalid.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/static-valid.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/valid-ref-2.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/valid-ref-3.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/valid-ref-4.html create mode 100644 layout/reftests/css-submit-invalid/input-submit/valid-ref.html create mode 100644 layout/reftests/css-submit-invalid/reftest.list diff --git a/content/events/public/nsIEventStateManager.h b/content/events/public/nsIEventStateManager.h index 16c628ecfe44..eaa43947b6f5 100644 --- a/content/events/public/nsIEventStateManager.h +++ b/content/events/public/nsIEventStateManager.h @@ -220,4 +220,16 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIEventStateManager, NS_IEVENTSTATEMANAGER_IID) // Content shows its placeholder #define NS_EVENT_STATE_MOZ_PLACEHOLDER (1 << 30) +// Content is a submit control and the form isn't valid. +#define NS_EVENT_STATE_MOZ_SUBMITINVALID (1U << 31) + +/** + * WARNING: + * (1U << 31) should work but we currently handle event states with PRInt32 + * so it's an edge case. + * DO NOT ADD AN EVENT STATE after NS_EVENT_STATE_MOZ_SUBMITINVALID until we + * move to PRUint64 and we introduce a type to handle event states. + * See bug 595036. + */ + #endif // nsIEventStateManager_h__ diff --git a/content/html/content/public/nsIConstraintValidation.h b/content/html/content/public/nsIConstraintValidation.h index b6a9dee64f57..e8256cd5fd37 100644 --- a/content/html/content/public/nsIConstraintValidation.h +++ b/content/html/content/public/nsIConstraintValidation.h @@ -44,7 +44,6 @@ class nsDOMValidityState; class nsIDOMValidityState; -class nsGenericHTMLFormElement; #define NS_ICONSTRAINTVALIDATION_IID \ { 0xca3824dc, 0x4f5c, 0x4878, \ @@ -69,7 +68,9 @@ public: PRBool IsValid() const { return mValidityBitField == 0; } - PRBool IsCandidateForConstraintValidation() const; + PRBool IsCandidateForConstraintValidation() const { + return !mBarredFromConstraintValidation; + } NS_IMETHOD GetValidationMessage(nsAString& aValidationMessage); @@ -98,15 +99,10 @@ protected: return mValidityBitField & mState; } - void SetValidityState(ValidityStateType mState, PRBool mValue) { - if (mValue) { - mValidityBitField |= mState; - } else { - mValidityBitField &= ~mState; - } - } + void SetValidityState(ValidityStateType mState, + PRBool mValue); - virtual PRBool IsBarredFromConstraintValidation() const { return PR_FALSE; } + void SetBarredFromConstraintValidation(PRBool aBarred); virtual nsresult GetValidationMessage(nsAString& aValidationMessage, ValidityStateType aType) { @@ -126,6 +122,11 @@ private: */ nsRefPtr mValidity; + /** + * Keeps track whether the element is barred from constraint validation. + */ + PRBool mBarredFromConstraintValidation; + /** * The string representing the custom error. */ diff --git a/content/html/content/src/nsHTMLButtonElement.cpp b/content/html/content/src/nsHTMLButtonElement.cpp index d031e9391dca..36bda43ee900 100644 --- a/content/html/content/src/nsHTMLButtonElement.cpp +++ b/content/html/content/src/nsHTMLButtonElement.cpp @@ -137,7 +137,7 @@ public: virtual nsXPCClassInfo* GetClassInfo(); // nsIConstraintValidation - PRBool IsBarredFromConstraintValidation() const; + void UpdateBarredFromConstraintValidation(); protected: virtual PRBool AcceptAutofocus() const @@ -615,18 +615,27 @@ nsresult nsHTMLButtonElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString* aValue, PRBool aNotify) { - if (aNameSpaceID == kNameSpaceID_None && - aName == nsGkAtoms::type) { - if (!aValue) { - mType = kButtonDefaultType->value; + PRInt32 states = 0; + + if (aNameSpaceID == kNameSpaceID_None) { + if (aName == nsGkAtoms::type) { + if (!aValue) { + mType = kButtonDefaultType->value; + } + + UpdateBarredFromConstraintValidation(); + states |= NS_EVENT_STATE_VALID | NS_EVENT_STATE_INVALID | + NS_EVENT_STATE_MOZ_SUBMITINVALID; + } else if (aName == nsGkAtoms::disabled) { + UpdateBarredFromConstraintValidation(); + states |= NS_EVENT_STATE_VALID | NS_EVENT_STATE_INVALID; } - if (aNotify) { + if (aNotify && states) { nsIDocument* doc = GetCurrentDoc(); if (doc) { MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE); - doc->ContentStatesChanged(this, nsnull, - NS_EVENT_STATE_VALID | NS_EVENT_STATE_INVALID); + doc->ContentStatesChanged(this, nsnull, states); } } } @@ -672,6 +681,10 @@ nsHTMLButtonElement::IntrinsicState() const state |= IsValid() ? NS_EVENT_STATE_VALID : NS_EVENT_STATE_INVALID; } + if (mForm && !mForm->GetValidity() && IsSubmitControl()) { + state |= NS_EVENT_STATE_MOZ_SUBMITINVALID; + } + return state | NS_EVENT_STATE_OPTIONAL; } @@ -692,10 +705,12 @@ nsHTMLButtonElement::SetCustomValidity(const nsAString& aError) return NS_OK; } -PRBool -nsHTMLButtonElement::IsBarredFromConstraintValidation() const +void +nsHTMLButtonElement::UpdateBarredFromConstraintValidation() { - return (mType == NS_FORM_BUTTON_BUTTON || - mType == NS_FORM_BUTTON_RESET); + SetBarredFromConstraintValidation(mType == NS_FORM_BUTTON_BUTTON || + mType == NS_FORM_BUTTON_RESET || + HasAttr(kNameSpaceID_None, + nsGkAtoms::disabled)); } diff --git a/content/html/content/src/nsHTMLFieldSetElement.cpp b/content/html/content/src/nsHTMLFieldSetElement.cpp index 3b58d98838f1..f2c27cd67f4e 100644 --- a/content/html/content/src/nsHTMLFieldSetElement.cpp +++ b/content/html/content/src/nsHTMLFieldSetElement.cpp @@ -75,9 +75,6 @@ public: NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission); virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; virtual nsXPCClassInfo* GetClassInfo(); - - // nsIConstraintValidation - PRBool IsBarredFromConstraintValidation() const { return PR_TRUE; }; }; // construction, destruction @@ -89,6 +86,8 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(FieldSet) nsHTMLFieldSetElement::nsHTMLFieldSetElement(already_AddRefed aNodeInfo) : nsGenericHTMLFormElement(aNodeInfo) { + //
is always barred from constraint validation. + SetBarredFromConstraintValidation(PR_TRUE); } nsHTMLFieldSetElement::~nsHTMLFieldSetElement() diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index 1333c2c73e99..3641b7e1cd25 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -80,6 +80,7 @@ #include "nsIHTMLCollection.h" #include "nsIConstraintValidation.h" +#include "nsIEventStateManager.h" static const int NS_FORM_CONTROL_LIST_HASHTABLE_SIZE = 16; @@ -250,7 +251,8 @@ nsHTMLFormElement::nsHTMLFormElement(already_AddRefed aNodeInfo) mSubmittingRequest(nsnull), mDefaultSubmitElement(nsnull), mFirstSubmitInElements(nsnull), - mFirstSubmitNotInElements(nsnull) + mFirstSubmitNotInElements(nsnull), + mInvalidElementsCount(0) { } @@ -484,6 +486,16 @@ CollectOrphans(nsINode* aRemovalRoot, nsTArray aArray node->UnsetFlags(MAYBE_ORPHAN_FORM_ELEMENT); if (!nsContentUtils::ContentIsDescendantOf(node, aRemovalRoot)) { node->ClearForm(PR_TRUE, PR_TRUE); + + // When submit controls have no more form, they need to be updated. + if (node->IsSubmitControl()) { + nsIDocument* doc = node->GetCurrentDoc(); + if (doc) { + MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE); + doc->ContentStatesChanged(node, nsnull, + NS_EVENT_STATE_MOZ_SUBMITINVALID); + } + } #ifdef DEBUG removed = PR_TRUE; #endif @@ -1200,6 +1212,15 @@ nsHTMLFormElement::AddElement(nsGenericHTMLFormElement* aChild, } } + // If the element is subject to constraint validaton and is invalid, we need + // to update our internal counter. + nsCOMPtr cvElmt = + do_QueryInterface(static_cast(aChild)); + if (cvElmt && + cvElmt->IsCandidateForConstraintValidation() && !cvElmt->IsValid()) { + UpdateValidity(PR_FALSE); + } + return NS_OK; } @@ -1267,6 +1288,15 @@ nsHTMLFormElement::RemoveElement(nsGenericHTMLFormElement* aChild, // own notifications. } + // If the element was subject to constraint validaton and is invalid, we need + // to update our internal counter. + nsCOMPtr cvElmt = + do_QueryInterface(static_cast(aChild)); + if (cvElmt && + cvElmt->IsCandidateForConstraintValidation() && !cvElmt->IsValid()) { + UpdateValidity(PR_TRUE); + } + return rv; } @@ -1616,6 +1646,60 @@ nsHTMLFormElement::CheckFormValidity() const return ret; } +void +nsHTMLFormElement::UpdateValidity(PRBool aElementValidity) +{ + if (aElementValidity) { + --mInvalidElementsCount; + } else { + ++mInvalidElementsCount; + } + + NS_ASSERTION(mInvalidElementsCount >= 0, "Something went seriously wrong!"); + + // The form validity has just changed if: + // - there are no more invalid elements ; + // - or there is one invalid elmement and an element just became invalid. + // If we have invalid elements and we used to before as well, do nothing. + if (mInvalidElementsCount && + (mInvalidElementsCount != 1 || aElementValidity)) { + return; + } + + nsIDocument* doc = GetCurrentDoc(); + if (!doc) { + return; + } + + /* + * We are going to call ContentStatesChanged assuming submit controls want to + * be notified because we can't know. + * UpdateValidity shouldn't be called so much during parsing so it _should_ + * be safe. + */ + + MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE); + + // Inform submit controls that the form validity has changed. + for (PRUint32 i = 0, length = mControls->mElements.Length(); + i < length; ++i) { + if (mControls->mElements[i]->IsSubmitControl()) { + doc->ContentStatesChanged(mControls->mElements[i], nsnull, + NS_EVENT_STATE_MOZ_SUBMITINVALID); + } + } + + // Because of backward compatibility, is not in elements + // so we have to check for controls not in elements too. + PRUint32 length = mControls->mNotInElements.Length(); + for (PRUint32 i = 0; i < length; ++i) { + if (mControls->mNotInElements[i]->IsSubmitControl()) { + doc->ContentStatesChanged(mControls->mNotInElements[i], nsnull, + NS_EVENT_STATE_MOZ_SUBMITINVALID); + } + } +} + // nsIWebProgressListener NS_IMETHODIMP nsHTMLFormElement::OnStateChange(nsIWebProgress* aWebProgress, diff --git a/content/html/content/src/nsHTMLFormElement.h b/content/html/content/src/nsHTMLFormElement.h index c54fdbf71eb1..938c7f9475ce 100644 --- a/content/html/content/src/nsHTMLFormElement.h +++ b/content/html/content/src/nsHTMLFormElement.h @@ -34,6 +34,10 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ + +#ifndef nsHTMLFormElement_h__ +#define nsHTMLFormElement_h__ + #include "nsCOMPtr.h" #include "nsIForm.h" #include "nsIFormControl.h" @@ -244,6 +248,29 @@ public: void OnSubmitClickBegin(nsIContent* aOriginatingElement); void OnSubmitClickEnd(); + /** + * This method will update the form validity so the submit controls states + * will be updated (for -moz-submit-invalid pseudo-class). + * This method has to be called by form elements whenever their validity state + * or status regarding constraint validation changes. + * + * @note This method isn't used for CheckValidity(). + * @note If an element becomes barred from constraint validation, it has to be + * considered as valid. + * + * @param aElementValidityState the new validity state of the element + */ + void UpdateValidity(PRBool aElementValidityState); + + /** + * Returns the form validity based on the last UpdateValidity() call. + * + * @return Whether the form was valid the last time UpdateValidity() was called. + * + * @note This method may not return the *current* validity state! + */ + PRBool GetValidity() const { return !mInvalidElementsCount; } + virtual nsXPCClassInfo* GetClassInfo(); protected: class RemoveElementRunnable; @@ -391,9 +418,18 @@ protected: /** The first submit element in mNotInElements -- WEAK */ nsGenericHTMLFormElement* mFirstSubmitNotInElements; + /** + * Number of invalid and candidate for constraint validation elements in the + * form the last time UpdateValidity has been called. + * @note Should only be used by UpdateValidity() and GetValidity()! + */ + PRInt32 mInvalidElementsCount; + protected: /** Detection of first form to notify observers */ static PRBool gFirstFormSubmitted; /** Detection of first password input to initialize the password manager */ static PRBool gPasswordManagerInitialized; }; + +#endif // nsHTMLFormElement_h__ diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index dd3d6ad8656f..fb3d2210c252 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -850,7 +850,9 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, // null) doesn't call ParseAttribute. HandleTypeChange(kInputDefaultType->value); } - + + UpdateBarredFromConstraintValidation(); + // If we are changing type from File/Text/Tel/Passwd to other input types // we need save the mValue into value attribute if (mInputData.mValue && @@ -899,12 +901,19 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, NS_EVENT_STATE_VALID | NS_EVENT_STATE_INVALID | NS_EVENT_STATE_INDETERMINATE | - NS_EVENT_STATE_MOZ_PLACEHOLDER; + NS_EVENT_STATE_MOZ_PLACEHOLDER | + NS_EVENT_STATE_MOZ_SUBMITINVALID; } if (aName == nsGkAtoms::required || aName == nsGkAtoms::disabled || aName == nsGkAtoms::readonly) { UpdateValueMissingValidityState(); + + // This *has* to be called *after* validity has changed. + if (aName == nsGkAtoms::readonly || aName == nsGkAtoms::disabled) { + UpdateBarredFromConstraintValidation(); + } + states |= NS_EVENT_STATE_REQUIRED | NS_EVENT_STATE_OPTIONAL | NS_EVENT_STATE_VALID | NS_EVENT_STATE_INVALID; } else if (aName == nsGkAtoms::maxlength) { @@ -3207,6 +3216,10 @@ nsHTMLInputElement::IntrinsicState() const } } + if (mForm && !mForm->GetValidity() && IsSubmitControl()) { + state |= NS_EVENT_STATE_MOZ_SUBMITINVALID; + } + return state; } @@ -3766,13 +3779,14 @@ nsHTMLInputElement::UpdateAllValidityStates(PRBool aNotify) } } -PRBool -nsHTMLInputElement::IsBarredFromConstraintValidation() const +void +nsHTMLInputElement::UpdateBarredFromConstraintValidation() { - return mType == NS_FORM_INPUT_HIDDEN || - mType == NS_FORM_INPUT_BUTTON || - mType == NS_FORM_INPUT_RESET || - HasAttr(kNameSpaceID_None, nsGkAtoms::readonly); + SetBarredFromConstraintValidation(mType == NS_FORM_INPUT_HIDDEN || + mType == NS_FORM_INPUT_BUTTON || + mType == NS_FORM_INPUT_RESET || + HasAttr(kNameSpaceID_None, nsGkAtoms::readonly) || + HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)); } nsresult diff --git a/content/html/content/src/nsHTMLInputElement.h b/content/html/content/src/nsHTMLInputElement.h index 4cc0daa8b0ee..7999d06ce847 100644 --- a/content/html/content/src/nsHTMLInputElement.h +++ b/content/html/content/src/nsHTMLInputElement.h @@ -273,7 +273,7 @@ public: void UpdateTypeMismatchValidityState(); void UpdatePatternMismatchValidityState(); void UpdateAllValidityStates(PRBool aNotify); - PRBool IsBarredFromConstraintValidation() const; + void UpdateBarredFromConstraintValidation(); nsresult GetValidationMessage(nsAString& aValidationMessage, ValidityStateType aType); diff --git a/content/html/content/src/nsHTMLObjectElement.cpp b/content/html/content/src/nsHTMLObjectElement.cpp index 608e82b63c2d..66ffd6b58d53 100644 --- a/content/html/content/src/nsHTMLObjectElement.cpp +++ b/content/html/content/src/nsHTMLObjectElement.cpp @@ -130,9 +130,6 @@ public: void StartObjectLoad() { StartObjectLoad(PR_TRUE); } - // nsIConstraintValidation - PRBool IsBarredFromConstraintValidation() const { return PR_TRUE; } - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLObjectElement, nsGenericHTMLFormElement) @@ -157,6 +154,9 @@ nsHTMLObjectElement::nsHTMLObjectElement(already_AddRefed aNodeInfo { RegisterFreezableElement(); SetIsNetworkCreated(aFromParser == NS_FROM_PARSER_NETWORK); + + // is always barred from constraint validation. + SetBarredFromConstraintValidation(PR_TRUE); } nsHTMLObjectElement::~nsHTMLObjectElement() diff --git a/content/html/content/src/nsHTMLOutputElement.cpp b/content/html/content/src/nsHTMLOutputElement.cpp index c65eddcde5fb..58ee14676cbd 100644 --- a/content/html/content/src/nsHTMLOutputElement.cpp +++ b/content/html/content/src/nsHTMLOutputElement.cpp @@ -83,9 +83,6 @@ public: // has to be used to update the defaultValue attribute. void DescendantsChanged(); - // nsIConstraintValidation - PRBool IsBarredFromConstraintValidation() const { return PR_TRUE; } - // nsIMutationObserver NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED @@ -116,6 +113,8 @@ nsHTMLOutputElement::nsHTMLOutputElement(already_AddRefed aNodeInfo , mValueModeFlag(eModeDefault) { AddMutationObserver(this); + // is always barred from constraint validation. + SetBarredFromConstraintValidation(PR_TRUE); } nsHTMLOutputElement::~nsHTMLOutputElement() diff --git a/content/html/content/src/nsHTMLSelectElement.cpp b/content/html/content/src/nsHTMLSelectElement.cpp index 37dd01c4e13a..dba0d9b979d1 100644 --- a/content/html/content/src/nsHTMLSelectElement.cpp +++ b/content/html/content/src/nsHTMLSelectElement.cpp @@ -1321,6 +1321,26 @@ nsHTMLSelectElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, aValue, aNotify); } +nsresult +nsHTMLSelectElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString* aValue, PRBool aNotify) +{ + if (aName == nsGkAtoms::disabled && aNameSpaceID == kNameSpaceID_None) { + SetBarredFromConstraintValidation(!!aValue); + if (aNotify) { + nsIDocument* doc = GetCurrentDoc(); + if (doc) { + MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE); + doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_VALID | + NS_EVENT_STATE_INVALID); + } + } + } + + return nsGenericHTMLFormElement::AfterSetAttr(aNameSpaceID, aName, + aValue, aNotify); +} + nsresult nsHTMLSelectElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) diff --git a/content/html/content/src/nsHTMLSelectElement.h b/content/html/content/src/nsHTMLSelectElement.h index ed2619ef589a..bc92c56b1fb6 100644 --- a/content/html/content/src/nsHTMLSelectElement.h +++ b/content/html/content/src/nsHTMLSelectElement.h @@ -287,6 +287,8 @@ public: */ virtual nsresult BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAString* aValue, PRBool aNotify); + virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString* aValue, PRBool aNotify); virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify); diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp index 6ac4c29e4d82..1dee59bd9811 100644 --- a/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -208,7 +208,7 @@ public: PRBool IsValueMissing() const; void UpdateTooLongValidityState(); void UpdateValueMissingValidityState(); - PRBool IsBarredFromConstraintValidation() const; + void UpdateBarredFromConstraintValidation(); nsresult GetValidationMessage(nsAString& aValidationMessage, ValidityStateType aType); @@ -1076,7 +1076,14 @@ nsHTMLTextAreaElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, if (aName == nsGkAtoms::required || aName == nsGkAtoms::disabled || aName == nsGkAtoms::readonly) { UpdateValueMissingValidityState(); - states |= NS_EVENT_STATE_VALID | NS_EVENT_STATE_INVALID; + + // This *has* to be called *after* validity has changed. + if (aName == nsGkAtoms::readonly || aName == nsGkAtoms::disabled) { + UpdateBarredFromConstraintValidation(); + } + + states |= NS_EVENT_STATE_VALID | NS_EVENT_STATE_INVALID | + NS_EVENT_STATE_MOZ_SUBMITINVALID; } else if (aName == nsGkAtoms::maxlength) { UpdateTooLongValidityState(); states |= NS_EVENT_STATE_VALID | NS_EVENT_STATE_INVALID; @@ -1180,10 +1187,13 @@ nsHTMLTextAreaElement::UpdateValueMissingValidityState() SetValidityState(VALIDITY_STATE_VALUE_MISSING, IsValueMissing()); } -PRBool -nsHTMLTextAreaElement::IsBarredFromConstraintValidation() const +void +nsHTMLTextAreaElement::UpdateBarredFromConstraintValidation() { - return HasAttr(kNameSpaceID_None, nsGkAtoms::readonly); + SetBarredFromConstraintValidation(HasAttr(kNameSpaceID_None, + nsGkAtoms::readonly) || + HasAttr(kNameSpaceID_None, + nsGkAtoms::disabled)); } nsresult diff --git a/content/html/content/src/nsIConstraintValidation.cpp b/content/html/content/src/nsIConstraintValidation.cpp index 37ae7c0e1b9f..c24603fc6648 100644 --- a/content/html/content/src/nsIConstraintValidation.cpp +++ b/content/html/content/src/nsIConstraintValidation.cpp @@ -41,11 +41,15 @@ #include "nsGenericHTMLElement.h" #include "nsHTMLFormElement.h" #include "nsDOMValidityState.h" +#include "nsIFormControl.h" +#include "nsHTMLFormElement.h" nsIConstraintValidation::nsIConstraintValidation() : mValidityBitField(0) , mValidity(nsnull) + // By default, all elements are subjects to constraint validation. + , mBarredFromConstraintValidation(PR_FALSE) { } @@ -115,6 +119,31 @@ nsIConstraintValidation::CheckValidity(PRBool* aValidity) PR_FALSE, PR_TRUE); } +void +nsIConstraintValidation::SetValidityState(ValidityStateType aState, + PRBool aValue) +{ + PRBool previousValidity = IsValid(); + + if (aValue) { + mValidityBitField |= aState; + } else { + mValidityBitField &= ~aState; + } + + // Inform the form element if our validity has changed. + if (previousValidity != IsValid() && IsCandidateForConstraintValidation()) { + nsCOMPtr formCtrl = do_QueryInterface(this); + NS_ASSERTION(formCtrl, "This interface should be used by form elements!"); + + nsHTMLFormElement* form = + static_cast(formCtrl->GetFormElement()); + if (form) { + form->UpdateValidity(IsValid()); + } + } +} + void nsIConstraintValidation::SetCustomValidity(const nsAString& aError) { @@ -122,28 +151,27 @@ nsIConstraintValidation::SetCustomValidity(const nsAString& aError) SetValidityState(VALIDITY_STATE_CUSTOM_ERROR, !mCustomValidity.IsEmpty()); } -PRBool -nsIConstraintValidation::IsCandidateForConstraintValidation() const +void +nsIConstraintValidation::SetBarredFromConstraintValidation(PRBool aBarred) { - /** - * An element is never candidate for constraint validation if: - * - it is disabled ; - * - TODO: or it's ancestor is a datalist element (bug 555840). - * We are doing these checks here to prevent writing them in every - * |IsBarredFromConstraintValidation| function. - */ + PRBool previousBarred = mBarredFromConstraintValidation; - nsCOMPtr content = - do_QueryInterface(const_cast(this)); - NS_ASSERTION(content, "This class should be inherited by HTML elements only!"); + mBarredFromConstraintValidation = aBarred; - // For the moment, all elements that are not barred from constraint validation - // accept the disabled attribute and elements that are always barred from - // constraint validation do not accept it (objects, fieldset, output). - // If one of these elements change and become not always barred from - // constraint validation or another element appear with constraint validation - // support and can't be disabled, this code will have to be changed. - return !content->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled) && - !IsBarredFromConstraintValidation(); + // Inform the form element if our status regarding constraint validation + // is going to change. + if (!IsValid() && previousBarred != mBarredFromConstraintValidation) { + nsCOMPtr formCtrl = do_QueryInterface(this); + NS_ASSERTION(formCtrl, "This interface should be used by form elements!"); + + nsHTMLFormElement* form = + static_cast(formCtrl->GetFormElement()); + if (form) { + // If the element is going to be barred from constraint validation, + // we can inform the form that we are now valid. + // Otherwise, we are now invalid. + form->UpdateValidity(aBarred); + } + } } diff --git a/layout/reftests/css-submit-invalid/button-submit/add-invalid-element.html b/layout/reftests/css-submit-invalid/button-submit/add-invalid-element.html new file mode 100644 index 000000000000..90a1429b6304 --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/add-invalid-element.html @@ -0,0 +1,21 @@ + + + + + + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/add-submit-control.html b/layout/reftests/css-submit-invalid/button-submit/add-submit-control.html new file mode 100644 index 000000000000..a9d5c2c1c05f --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/add-submit-control.html @@ -0,0 +1,21 @@ + + + + + + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/change-type-not-submit-control.html b/layout/reftests/css-submit-invalid/button-submit/change-type-not-submit-control.html new file mode 100644 index 000000000000..9667e3a26a54 --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/change-type-not-submit-control.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/change-type-submit-control.html b/layout/reftests/css-submit-invalid/button-submit/change-type-submit-control.html new file mode 100644 index 000000000000..cc71e850b445 --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/change-type-submit-control.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/dynamic-invalid-barred-2.html b/layout/reftests/css-submit-invalid/button-submit/dynamic-invalid-barred-2.html new file mode 100644 index 000000000000..6b8bd26c63be --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/dynamic-invalid-barred-2.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/dynamic-invalid-barred.html b/layout/reftests/css-submit-invalid/button-submit/dynamic-invalid-barred.html new file mode 100644 index 000000000000..cbe8162123d8 --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/dynamic-invalid-barred.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/dynamic-invalid-not-barred.html b/layout/reftests/css-submit-invalid/button-submit/dynamic-invalid-not-barred.html new file mode 100644 index 000000000000..c396d6735e2e --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/dynamic-invalid-not-barred.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/dynamic-invalid.html b/layout/reftests/css-submit-invalid/button-submit/dynamic-invalid.html new file mode 100644 index 000000000000..49bd26ca032f --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/dynamic-invalid.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/dynamic-valid.html b/layout/reftests/css-submit-invalid/button-submit/dynamic-valid.html new file mode 100644 index 000000000000..59d2948ac989 --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/dynamic-valid.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/invalid-barred-ref.html b/layout/reftests/css-submit-invalid/button-submit/invalid-barred-ref.html new file mode 100644 index 000000000000..7c319e41b656 --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/invalid-barred-ref.html @@ -0,0 +1,9 @@ + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/invalid-ref-2.html b/layout/reftests/css-submit-invalid/button-submit/invalid-ref-2.html new file mode 100644 index 000000000000..dd03dc812f6b --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/invalid-ref-2.html @@ -0,0 +1,8 @@ + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/invalid-ref-3.html b/layout/reftests/css-submit-invalid/button-submit/invalid-ref-3.html new file mode 100644 index 000000000000..c348d5f374db --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/invalid-ref-3.html @@ -0,0 +1,11 @@ + + + + + + + + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/invalid-ref.html b/layout/reftests/css-submit-invalid/button-submit/invalid-ref.html new file mode 100644 index 000000000000..76d80f6fa466 --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/invalid-ref.html @@ -0,0 +1,8 @@ + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/reftest.list b/layout/reftests/css-submit-invalid/button-submit/reftest.list new file mode 100644 index 000000000000..cfb8df94e45c --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/reftest.list @@ -0,0 +1,16 @@ +== static-valid.html valid-ref.html +== dynamic-valid.html valid-ref.html +== static-invalid.html invalid-ref.html +== dynamic-invalid.html invalid-ref.html +== dynamic-invalid-barred.html invalid-barred-ref.html +== dynamic-invalid-barred-2.html invalid-barred-ref.html +== dynamic-invalid-not-barred.html invalid-ref.html +== static-invalid-barred.html invalid-barred-ref.html +== remove-invalid-element.html valid-ref-2.html +== add-invalid-element.html invalid-ref-2.html +== add-submit-control.html invalid-ref.html +== remove-submit-control.html valid-ref-3.html +== change-type-submit-control.html invalid-ref.html +== change-type-not-submit-control.html valid-ref-4.html +== self-invalid.html about:blank +== remove-form.html invalid-ref-3.html diff --git a/layout/reftests/css-submit-invalid/button-submit/remove-form.html b/layout/reftests/css-submit-invalid/button-submit/remove-form.html new file mode 100644 index 000000000000..a5432971496f --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/remove-form.html @@ -0,0 +1,23 @@ + + + + + + + + + + + + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/remove-invalid-element.html b/layout/reftests/css-submit-invalid/button-submit/remove-invalid-element.html new file mode 100644 index 000000000000..c92d134c4d2f --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/remove-invalid-element.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/remove-submit-control.html b/layout/reftests/css-submit-invalid/button-submit/remove-submit-control.html new file mode 100644 index 000000000000..3acd342dfe2f --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/remove-submit-control.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/self-invalid.html b/layout/reftests/css-submit-invalid/button-submit/self-invalid.html new file mode 100644 index 000000000000..c4986b3b0f95 --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/self-invalid.html @@ -0,0 +1,20 @@ + + + + + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/static-invalid-barred.html b/layout/reftests/css-submit-invalid/button-submit/static-invalid-barred.html new file mode 100644 index 000000000000..57b06a04af27 --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/static-invalid-barred.html @@ -0,0 +1,14 @@ + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/static-invalid.html b/layout/reftests/css-submit-invalid/button-submit/static-invalid.html new file mode 100644 index 000000000000..708c96728363 --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/static-invalid.html @@ -0,0 +1,14 @@ + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/static-valid.html b/layout/reftests/css-submit-invalid/button-submit/static-valid.html new file mode 100644 index 000000000000..953c55a18c7b --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/static-valid.html @@ -0,0 +1,14 @@ + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/valid-ref-2.html b/layout/reftests/css-submit-invalid/button-submit/valid-ref-2.html new file mode 100644 index 000000000000..d9f1786a7b4a --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/valid-ref-2.html @@ -0,0 +1,8 @@ + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/valid-ref-3.html b/layout/reftests/css-submit-invalid/button-submit/valid-ref-3.html new file mode 100644 index 000000000000..cd0ba4c93fc4 --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/valid-ref-3.html @@ -0,0 +1,9 @@ + + + +
+ +
+ + + diff --git a/layout/reftests/css-submit-invalid/button-submit/valid-ref-4.html b/layout/reftests/css-submit-invalid/button-submit/valid-ref-4.html new file mode 100644 index 000000000000..04f1e436c6ee --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/valid-ref-4.html @@ -0,0 +1,9 @@ + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/button-submit/valid-ref.html b/layout/reftests/css-submit-invalid/button-submit/valid-ref.html new file mode 100644 index 000000000000..12d113480509 --- /dev/null +++ b/layout/reftests/css-submit-invalid/button-submit/valid-ref.html @@ -0,0 +1,9 @@ + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/add-invalid-element.html b/layout/reftests/css-submit-invalid/input-image/add-invalid-element.html new file mode 100644 index 000000000000..6b697a7db8a0 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/add-invalid-element.html @@ -0,0 +1,21 @@ + + + + + + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/add-submit-control.html b/layout/reftests/css-submit-invalid/input-image/add-submit-control.html new file mode 100644 index 000000000000..b6bbc9cc0f27 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/add-submit-control.html @@ -0,0 +1,21 @@ + + + + + + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/change-type-not-submit-control.html b/layout/reftests/css-submit-invalid/input-image/change-type-not-submit-control.html new file mode 100644 index 000000000000..f9656f6c0b59 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/change-type-not-submit-control.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/change-type-submit-control.html b/layout/reftests/css-submit-invalid/input-image/change-type-submit-control.html new file mode 100644 index 000000000000..370743bf8d77 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/change-type-submit-control.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/dynamic-invalid-barred-2.html b/layout/reftests/css-submit-invalid/input-image/dynamic-invalid-barred-2.html new file mode 100644 index 000000000000..86782baf4b0d --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/dynamic-invalid-barred-2.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/dynamic-invalid-barred.html b/layout/reftests/css-submit-invalid/input-image/dynamic-invalid-barred.html new file mode 100644 index 000000000000..b54b8f123af4 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/dynamic-invalid-barred.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/dynamic-invalid-not-barred.html b/layout/reftests/css-submit-invalid/input-image/dynamic-invalid-not-barred.html new file mode 100644 index 000000000000..77fd69526970 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/dynamic-invalid-not-barred.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/dynamic-invalid.html b/layout/reftests/css-submit-invalid/input-image/dynamic-invalid.html new file mode 100644 index 000000000000..fb7a5fed9f62 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/dynamic-invalid.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/dynamic-valid.html b/layout/reftests/css-submit-invalid/input-image/dynamic-valid.html new file mode 100644 index 000000000000..342efb17dcaa --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/dynamic-valid.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/invalid-barred-ref.html b/layout/reftests/css-submit-invalid/input-image/invalid-barred-ref.html new file mode 100644 index 000000000000..305b03698f93 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/invalid-barred-ref.html @@ -0,0 +1,9 @@ + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/invalid-ref-2.html b/layout/reftests/css-submit-invalid/input-image/invalid-ref-2.html new file mode 100644 index 000000000000..dd03dc812f6b --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/invalid-ref-2.html @@ -0,0 +1,8 @@ + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/invalid-ref-3.html b/layout/reftests/css-submit-invalid/input-image/invalid-ref-3.html new file mode 100644 index 000000000000..2f3cd93cf3eb --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/invalid-ref-3.html @@ -0,0 +1,11 @@ + + + + + + + + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/invalid-ref.html b/layout/reftests/css-submit-invalid/input-image/invalid-ref.html new file mode 100644 index 000000000000..76d80f6fa466 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/invalid-ref.html @@ -0,0 +1,8 @@ + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/reftest.list b/layout/reftests/css-submit-invalid/input-image/reftest.list new file mode 100644 index 000000000000..cfb8df94e45c --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/reftest.list @@ -0,0 +1,16 @@ +== static-valid.html valid-ref.html +== dynamic-valid.html valid-ref.html +== static-invalid.html invalid-ref.html +== dynamic-invalid.html invalid-ref.html +== dynamic-invalid-barred.html invalid-barred-ref.html +== dynamic-invalid-barred-2.html invalid-barred-ref.html +== dynamic-invalid-not-barred.html invalid-ref.html +== static-invalid-barred.html invalid-barred-ref.html +== remove-invalid-element.html valid-ref-2.html +== add-invalid-element.html invalid-ref-2.html +== add-submit-control.html invalid-ref.html +== remove-submit-control.html valid-ref-3.html +== change-type-submit-control.html invalid-ref.html +== change-type-not-submit-control.html valid-ref-4.html +== self-invalid.html about:blank +== remove-form.html invalid-ref-3.html diff --git a/layout/reftests/css-submit-invalid/input-image/remove-form.html b/layout/reftests/css-submit-invalid/input-image/remove-form.html new file mode 100644 index 000000000000..628694b8af3c --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/remove-form.html @@ -0,0 +1,23 @@ + + + + + + + + + + + + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/remove-invalid-element.html b/layout/reftests/css-submit-invalid/input-image/remove-invalid-element.html new file mode 100644 index 000000000000..643fd0da870d --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/remove-invalid-element.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/remove-submit-control.html b/layout/reftests/css-submit-invalid/input-image/remove-submit-control.html new file mode 100644 index 000000000000..81e7f0cf0898 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/remove-submit-control.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/self-invalid.html b/layout/reftests/css-submit-invalid/input-image/self-invalid.html new file mode 100644 index 000000000000..7970e356408e --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/self-invalid.html @@ -0,0 +1,20 @@ + + + + + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/static-invalid-barred.html b/layout/reftests/css-submit-invalid/input-image/static-invalid-barred.html new file mode 100644 index 000000000000..b4d68cc2605b --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/static-invalid-barred.html @@ -0,0 +1,14 @@ + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/static-invalid.html b/layout/reftests/css-submit-invalid/input-image/static-invalid.html new file mode 100644 index 000000000000..5bf007b74ae6 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/static-invalid.html @@ -0,0 +1,14 @@ + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/static-valid.html b/layout/reftests/css-submit-invalid/input-image/static-valid.html new file mode 100644 index 000000000000..fea6dd8ae308 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/static-valid.html @@ -0,0 +1,14 @@ + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/valid-ref-2.html b/layout/reftests/css-submit-invalid/input-image/valid-ref-2.html new file mode 100644 index 000000000000..56c903dc4d6e --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/valid-ref-2.html @@ -0,0 +1,8 @@ + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/valid-ref-3.html b/layout/reftests/css-submit-invalid/input-image/valid-ref-3.html new file mode 100644 index 000000000000..91bf77cc833c --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/valid-ref-3.html @@ -0,0 +1,9 @@ + + + +
+ +
+ + + diff --git a/layout/reftests/css-submit-invalid/input-image/valid-ref-4.html b/layout/reftests/css-submit-invalid/input-image/valid-ref-4.html new file mode 100644 index 000000000000..df70b8f34618 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/valid-ref-4.html @@ -0,0 +1,9 @@ + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-image/valid-ref.html b/layout/reftests/css-submit-invalid/input-image/valid-ref.html new file mode 100644 index 000000000000..634a8c7efac7 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-image/valid-ref.html @@ -0,0 +1,9 @@ + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/add-invalid-element.html b/layout/reftests/css-submit-invalid/input-submit/add-invalid-element.html new file mode 100644 index 000000000000..2c15539146fd --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/add-invalid-element.html @@ -0,0 +1,21 @@ + + + + + + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/add-submit-control.html b/layout/reftests/css-submit-invalid/input-submit/add-submit-control.html new file mode 100644 index 000000000000..ca50270dbd21 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/add-submit-control.html @@ -0,0 +1,21 @@ + + + + + + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/change-type-not-submit-control.html b/layout/reftests/css-submit-invalid/input-submit/change-type-not-submit-control.html new file mode 100644 index 000000000000..d1a2f3438805 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/change-type-not-submit-control.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/change-type-submit-control.html b/layout/reftests/css-submit-invalid/input-submit/change-type-submit-control.html new file mode 100644 index 000000000000..5ce8dd7f778a --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/change-type-submit-control.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/dynamic-invalid-barred-2.html b/layout/reftests/css-submit-invalid/input-submit/dynamic-invalid-barred-2.html new file mode 100644 index 000000000000..6768e71d018a --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/dynamic-invalid-barred-2.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/dynamic-invalid-barred.html b/layout/reftests/css-submit-invalid/input-submit/dynamic-invalid-barred.html new file mode 100644 index 000000000000..327bbb200c8b --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/dynamic-invalid-barred.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/dynamic-invalid-not-barred.html b/layout/reftests/css-submit-invalid/input-submit/dynamic-invalid-not-barred.html new file mode 100644 index 000000000000..8c0eb9078805 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/dynamic-invalid-not-barred.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/dynamic-invalid.html b/layout/reftests/css-submit-invalid/input-submit/dynamic-invalid.html new file mode 100644 index 000000000000..1f0f94ba0520 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/dynamic-invalid.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/dynamic-valid.html b/layout/reftests/css-submit-invalid/input-submit/dynamic-valid.html new file mode 100644 index 000000000000..1151e7bb7086 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/dynamic-valid.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/invalid-barred-ref.html b/layout/reftests/css-submit-invalid/input-submit/invalid-barred-ref.html new file mode 100644 index 000000000000..ff532c819348 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/invalid-barred-ref.html @@ -0,0 +1,9 @@ + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/invalid-ref-2.html b/layout/reftests/css-submit-invalid/input-submit/invalid-ref-2.html new file mode 100644 index 000000000000..dd03dc812f6b --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/invalid-ref-2.html @@ -0,0 +1,8 @@ + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/invalid-ref-3.html b/layout/reftests/css-submit-invalid/input-submit/invalid-ref-3.html new file mode 100644 index 000000000000..188dd5850f1d --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/invalid-ref-3.html @@ -0,0 +1,11 @@ + + + + + + + + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/invalid-ref.html b/layout/reftests/css-submit-invalid/input-submit/invalid-ref.html new file mode 100644 index 000000000000..76d80f6fa466 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/invalid-ref.html @@ -0,0 +1,8 @@ + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/reftest.list b/layout/reftests/css-submit-invalid/input-submit/reftest.list new file mode 100644 index 000000000000..cfb8df94e45c --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/reftest.list @@ -0,0 +1,16 @@ +== static-valid.html valid-ref.html +== dynamic-valid.html valid-ref.html +== static-invalid.html invalid-ref.html +== dynamic-invalid.html invalid-ref.html +== dynamic-invalid-barred.html invalid-barred-ref.html +== dynamic-invalid-barred-2.html invalid-barred-ref.html +== dynamic-invalid-not-barred.html invalid-ref.html +== static-invalid-barred.html invalid-barred-ref.html +== remove-invalid-element.html valid-ref-2.html +== add-invalid-element.html invalid-ref-2.html +== add-submit-control.html invalid-ref.html +== remove-submit-control.html valid-ref-3.html +== change-type-submit-control.html invalid-ref.html +== change-type-not-submit-control.html valid-ref-4.html +== self-invalid.html about:blank +== remove-form.html invalid-ref-3.html diff --git a/layout/reftests/css-submit-invalid/input-submit/remove-form.html b/layout/reftests/css-submit-invalid/input-submit/remove-form.html new file mode 100644 index 000000000000..e33e79c59b10 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/remove-form.html @@ -0,0 +1,23 @@ + + + + + + + + + + + + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/remove-invalid-element.html b/layout/reftests/css-submit-invalid/input-submit/remove-invalid-element.html new file mode 100644 index 000000000000..0e40a76e03f5 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/remove-invalid-element.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/remove-submit-control.html b/layout/reftests/css-submit-invalid/input-submit/remove-submit-control.html new file mode 100644 index 000000000000..7c7a0da05781 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/remove-submit-control.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/self-invalid.html b/layout/reftests/css-submit-invalid/input-submit/self-invalid.html new file mode 100644 index 000000000000..a7b97b216d0e --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/self-invalid.html @@ -0,0 +1,20 @@ + + + + + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/static-invalid-barred.html b/layout/reftests/css-submit-invalid/input-submit/static-invalid-barred.html new file mode 100644 index 000000000000..cc0b1c24a456 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/static-invalid-barred.html @@ -0,0 +1,14 @@ + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/static-invalid.html b/layout/reftests/css-submit-invalid/input-submit/static-invalid.html new file mode 100644 index 000000000000..84c47cce6fe6 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/static-invalid.html @@ -0,0 +1,14 @@ + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/static-valid.html b/layout/reftests/css-submit-invalid/input-submit/static-valid.html new file mode 100644 index 000000000000..6401eb893a15 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/static-valid.html @@ -0,0 +1,14 @@ + + + + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/valid-ref-2.html b/layout/reftests/css-submit-invalid/input-submit/valid-ref-2.html new file mode 100644 index 000000000000..81ccd0610faf --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/valid-ref-2.html @@ -0,0 +1,8 @@ + + + +
+ +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/valid-ref-3.html b/layout/reftests/css-submit-invalid/input-submit/valid-ref-3.html new file mode 100644 index 000000000000..ac162eaa4156 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/valid-ref-3.html @@ -0,0 +1,9 @@ + + + +
+ +
+ + + diff --git a/layout/reftests/css-submit-invalid/input-submit/valid-ref-4.html b/layout/reftests/css-submit-invalid/input-submit/valid-ref-4.html new file mode 100644 index 000000000000..df70b8f34618 --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/valid-ref-4.html @@ -0,0 +1,9 @@ + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/input-submit/valid-ref.html b/layout/reftests/css-submit-invalid/input-submit/valid-ref.html new file mode 100644 index 000000000000..b8b5466dda4d --- /dev/null +++ b/layout/reftests/css-submit-invalid/input-submit/valid-ref.html @@ -0,0 +1,9 @@ + + + +
+ + +
+ + diff --git a/layout/reftests/css-submit-invalid/reftest.list b/layout/reftests/css-submit-invalid/reftest.list new file mode 100644 index 000000000000..b9ba21273414 --- /dev/null +++ b/layout/reftests/css-submit-invalid/reftest.list @@ -0,0 +1,3 @@ +include button-submit/reftest.list +include input-image/reftest.list +include input-submit/reftest.list diff --git a/layout/reftests/reftest.list b/layout/reftests/reftest.list index 6a9e8a36e5bb..552602959c02 100644 --- a/layout/reftests/reftest.list +++ b/layout/reftests/reftest.list @@ -80,6 +80,9 @@ include css-valid/reftest.list # css invalid include css-invalid/reftest.list +# css-submit-invalid +include css-submit-invalid/reftest.list + # css transitions include css-transitions/reftest.list diff --git a/layout/style/nsCSSPseudoClassList.h b/layout/style/nsCSSPseudoClassList.h index e9ef48dbbd12..31dcb6322c2b 100644 --- a/layout/style/nsCSSPseudoClassList.h +++ b/layout/style/nsCSSPseudoClassList.h @@ -176,6 +176,8 @@ CSS_STATE_PSEUDO_CLASS(mozReadWrite, ":-moz-read-write", NS_EVENT_STATE_MOZ_READWRITE) CSS_STATE_PSEUDO_CLASS(mozPlaceholder, ":-moz-placeholder", NS_EVENT_STATE_MOZ_PLACEHOLDER) +CSS_STATE_PSEUDO_CLASS(mozSubmitInvalid, ":-moz-submit-invalid", + NS_EVENT_STATE_MOZ_SUBMITINVALID) #ifdef DEFINED_CSS_STATE_PSEUDO_CLASS #undef DEFINED_CSS_STATE_PSEUDO_CLASS From 06546aad2393e19813bf94282bf3b34058db360a Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Fri, 10 Sep 2010 07:16:56 +0200 Subject: [PATCH 111/176] Bug 555840 - Implement datalist element. r=sicking,mrbkap,ehsan sr=smaug a2.0=roc --- content/base/src/nsGkAtomList.h | 1 + content/html/content/src/Makefile.in | 1 + .../html/content/src/nsGenericHTMLElement.h | 1 + .../content/src/nsHTMLDataListElement.cpp | 141 ++++++++++++++++++ content/html/content/test/Makefile.in | 1 + content/html/content/test/test_bug389797.html | 1 + content/html/content/test/test_bug555840.html | 87 +++++++++++ dom/base/nsDOMClassInfo.cpp | 8 + dom/base/nsDOMClassInfoClasses.h | 1 + dom/interfaces/html/Makefile.in | 1 + .../html/nsIDOMHTMLDataListElement.idl | 57 +++++++ .../libeditor/base/nsEditPropertyAtomList.h | 1 + editor/libeditor/html/nsHTMLEditUtils.cpp | 11 +- layout/reftests/datalist/datalist-errors.html | 12 ++ layout/reftests/datalist/datalist-simple.html | 10 ++ layout/reftests/datalist/reftest.list | 2 + layout/reftests/reftest.list | 3 + layout/style/html.css | 2 +- parser/htmlparser/public/nsHTMLTagList.h | 1 + parser/htmlparser/src/nsElementTable.cpp | 9 ++ parser/htmlparser/src/nsHTMLTags.cpp | 2 + 21 files changed, 348 insertions(+), 5 deletions(-) create mode 100644 content/html/content/src/nsHTMLDataListElement.cpp create mode 100644 content/html/content/test/test_bug555840.html create mode 100644 dom/interfaces/html/nsIDOMHTMLDataListElement.idl create mode 100644 layout/reftests/datalist/datalist-errors.html create mode 100644 layout/reftests/datalist/datalist-simple.html create mode 100644 layout/reftests/datalist/reftest.list diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 423e5c7e7bd6..fc4999f60944 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -262,6 +262,7 @@ GK_ATOM(currentloop, "currentloop") #endif GK_ATOM(cycler, "cycler") GK_ATOM(data, "data") +GK_ATOM(datalist, "datalist") GK_ATOM(dataType, "data-type") GK_ATOM(datasources, "datasources") GK_ATOM(datetime, "datetime") diff --git a/content/html/content/src/Makefile.in b/content/html/content/src/Makefile.in index b6f8dd5b405d..5e1f543102dc 100644 --- a/content/html/content/src/Makefile.in +++ b/content/html/content/src/Makefile.in @@ -72,6 +72,7 @@ CPPSRCS = \ nsHTMLBodyElement.cpp \ nsHTMLButtonElement.cpp \ nsHTMLCanvasElement.cpp \ + nsHTMLDataListElement.cpp \ nsHTMLDelElement.cpp \ nsHTMLDivElement.cpp \ nsHTMLFieldSetElement.cpp \ diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h index da9f15294853..473e823eee6c 100644 --- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -1405,6 +1405,7 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(Body) NS_DECLARE_NS_NEW_HTML_ELEMENT(Button) NS_DECLARE_NS_NEW_HTML_ELEMENT(Canvas) NS_DECLARE_NS_NEW_HTML_ELEMENT(Mod) +NS_DECLARE_NS_NEW_HTML_ELEMENT(DataList) NS_DECLARE_NS_NEW_HTML_ELEMENT(Div) NS_DECLARE_NS_NEW_HTML_ELEMENT(FieldSet) NS_DECLARE_NS_NEW_HTML_ELEMENT(Font) diff --git a/content/html/content/src/nsHTMLDataListElement.cpp b/content/html/content/src/nsHTMLDataListElement.cpp new file mode 100644 index 000000000000..b6a199ea015a --- /dev/null +++ b/content/html/content/src/nsHTMLDataListElement.cpp @@ -0,0 +1,141 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Mozilla Foundation + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Mounir Lamouri (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIDOMHTMLDataListElement.h" +#include "nsGenericHTMLElement.h" +#include "nsIDOMEventTarget.h" +#include "nsGkAtoms.h" +#include "nsIDOMHTMLOptionElement.h" + + +class nsHTMLDataListElement : public nsGenericHTMLElement, + public nsIDOMHTMLDataListElement +{ +public: + nsHTMLDataListElement(already_AddRefed aNodeInfo); + virtual ~nsHTMLDataListElement(); + + // nsISupports + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + + // nsIDOMNode + NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) + + // nsIDOMElement + NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) + + // nsIDOMHTMLElement + NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) + + // nsIDOMHTMLDataListElement + NS_DECL_NSIDOMHTMLDATALISTELEMENT + + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + + // This function is used to generate the nsContentList (option elements). + static PRBool MatchOptions(nsIContent* aContent, PRInt32 aNamespaceID, + nsIAtom* aAtom, void* aData); + + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLDataListElement, + nsGenericHTMLElement) + + virtual nsXPCClassInfo* GetClassInfo(); + +protected: + + //
From 9959033066ce0e6ff3acad3373befe37bd83bb44 Mon Sep 17 00:00:00 2001 From: Oleg Romashin Date: Fri, 10 Sep 2010 11:36:25 -0700 Subject: [PATCH 160/176] Bug 594338 - lmozjs is not available in latest xulrunner SDK... but still present in mozilla-js.pc.in. r=khuey a=approval2.0 --HG-- extra : rebase_source : 564bbbc8c73b63fb215356294e05d44e6835e2df --- xulrunner/installer/Makefile.in | 9 +++++++++ xulrunner/installer/libxul.pc.in | 2 +- xulrunner/installer/mozilla-js.pc.in | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/xulrunner/installer/Makefile.in b/xulrunner/installer/Makefile.in index d04d19cacdb8..88796a3d39f8 100644 --- a/xulrunner/installer/Makefile.in +++ b/xulrunner/installer/Makefile.in @@ -102,6 +102,13 @@ FULL_NSPR_LIBS=$(subst $(prefix),\$${sdkdir},$(shell $(DEPTH)/nsprpub/config/nsp NSPR_VERSION=$(shell $(DEPTH)/nsprpub/config/nspr-config --version) endif +MOZ_XUL_LINK = -lxpcomglue_s -lxul -lxpcom +ifdef JS_SHARED_LIBRARY +MOZ_JS_LINK = -lmozjs +else +MOZ_JS_LINK = $(MOZ_XUL_LINK) +endif + $(warning FULL_NSPR_CFLAGS=$(FULL_NSPR_CFLAGS)) ifndef MOZ_NATIVE_NSS @@ -121,6 +128,8 @@ endif -e "s|%FULL_NSPR_CFLAGS%|$(FULL_NSPR_CFLAGS)|" \ -e "s|%NSPR_NAME%|$(NSPR_NAME)|" \ -e "s|%NSPR_VERSION%|$(NSPR_VERSION)|" > $@ + -e "s|%MOZ_XUL_LINK%|$(MOZ_XUL_LINK)|" \ + -e "s|%MOZ_JS_LINK%|$(MOZ_JS_LINK)|" \ chmod 644 $@ install:: $(pkg_config_files) diff --git a/xulrunner/installer/libxul.pc.in b/xulrunner/installer/libxul.pc.in index 989732a4300f..ccce9aa59280 100644 --- a/xulrunner/installer/libxul.pc.in +++ b/xulrunner/installer/libxul.pc.in @@ -7,5 +7,5 @@ Name: libxul Description: The Mozilla Runtime and Embedding Engine Version: %MOZILLA_VERSION% Requires: %NSPR_NAME% >= %NSPR_VERSION% -Libs: -L${sdkdir}/lib -lxpcomglue_s -lxul -lxpcom +Libs: -L${sdkdir}/lib %MOZ_XUL_LINK% Cflags: -I${includedir} %WCHAR_CFLAGS% diff --git a/xulrunner/installer/mozilla-js.pc.in b/xulrunner/installer/mozilla-js.pc.in index 672ca6af1e64..c1428f10b52c 100644 --- a/xulrunner/installer/mozilla-js.pc.in +++ b/xulrunner/installer/mozilla-js.pc.in @@ -6,5 +6,5 @@ Name: JavaScript Description: The Mozilla JavaScript Library Version: %MOZILLA_VERSION% Requires: %NSPR_NAME% >= %NSPR_VERSION% -Libs: -L${sdkdir}/lib -lmozjs +Libs: -L${sdkdir}/lib %MOZ_JS_LINK% Cflags: -I${includedir} -DXP_UNIX -DJS_THREADSAFE From c9978327b52a02a7b536a72a3c910f964a07eb24 Mon Sep 17 00:00:00 2001 From: Ben Turner Date: Fri, 10 Sep 2010 12:12:11 -0700 Subject: [PATCH 161/176] Bug 594583 - 'IndexedDB: Add some UI to clear IndexedDB databases'. r=sicking+gavin. a=beta6blocking. --- browser/base/content/pageinfo/pageInfo.xul | 19 + browser/base/content/pageinfo/permissions.js | 58 ++- .../locales/en-US/chrome/browser/pageInfo.dtd | 4 + .../en-US/chrome/browser/pageInfo.properties | 7 + dom/indexedDB/AsyncConnectionHelper.cpp | 14 +- dom/indexedDB/IDBDatabase.cpp | 49 +- dom/indexedDB/IDBDatabase.h | 6 + dom/indexedDB/IDBFactory.cpp | 31 +- dom/indexedDB/IDBFactory.h | 4 + dom/indexedDB/IDBTransaction.cpp | 11 +- dom/indexedDB/IndexedDatabaseManager.cpp | 420 ++++++++++++++++++ dom/indexedDB/IndexedDatabaseManager.h | 101 +++++ dom/indexedDB/Makefile.in | 3 + dom/indexedDB/TransactionThreadPool.cpp | 29 ++ dom/indexedDB/TransactionThreadPool.h | 3 + dom/indexedDB/nsIIndexedDatabaseManager.idl | 50 +++ layout/build/nsLayoutCID.h | 4 + layout/build/nsLayoutModule.cpp | 8 + 18 files changed, 814 insertions(+), 7 deletions(-) create mode 100644 dom/indexedDB/IndexedDatabaseManager.cpp create mode 100644 dom/indexedDB/IndexedDatabaseManager.h create mode 100644 dom/indexedDB/nsIIndexedDatabaseManager.idl diff --git a/browser/base/content/pageinfo/pageInfo.xul b/browser/base/content/pageinfo/pageInfo.xul index 9931b1a2bc22..3cb71a5ce852 100644 --- a/browser/base/content/pageinfo/pageInfo.xul +++ b/browser/base/content/pageinfo/pageInfo.xul @@ -89,11 +89,13 @@ + + @@ -375,6 +377,23 @@ + +