From 39972a3a677e99ed268ba9e90240dcd67c88fee3 Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Wed, 6 Aug 2014 18:05:11 -0400 Subject: [PATCH 001/100] Bug 1040087 - For root scroll frames, use the canvas background color calculated by the pres shell when overscrolling. r=tn --- layout/base/nsDisplayList.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index db4bc9dc226..860ac2b9c8c 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -832,12 +832,13 @@ static void RecordFrameMetrics(nsIFrame* aForFrame, // Also compute and set the background color on the container. // This is needed for APZ overscrolling support. if (aScrollFrame) { - // FindBackground() does not work for a root scroll frame, need to use the - // root frame instead. - nsIFrame* backgroundFrame = isRootScrollFrame ? presShell->GetRootFrame() : aScrollFrame; - nsStyleContext* backgroundStyle; - if (nsCSSRendering::FindBackground(backgroundFrame, &backgroundStyle)) { - aRoot->SetBackgroundColor(backgroundStyle->StyleBackground()->mBackgroundColor); + if (isRootScrollFrame) { + aRoot->SetBackgroundColor(presShell->GetCanvasBackground()); + } else { + nsStyleContext* backgroundStyle; + if (nsCSSRendering::FindBackground(aScrollFrame, &backgroundStyle)) { + aRoot->SetBackgroundColor(backgroundStyle->StyleBackground()->mBackgroundColor); + } } } } From 6bb386a6a9d9c890720bfe2e50d1dd17fd251440 Mon Sep 17 00:00:00 2001 From: David Parks Date: Wed, 30 Jul 2014 23:44:31 -0700 Subject: [PATCH 002/100] Bug 1041695 - Run ShadowLayersForwarder::ReleaseTexture on worker thread r=nical --- gfx/layers/ipc/ShadowLayers.cpp | 33 ++++++++++++++++++++++++++++++++- gfx/layers/ipc/ShadowLayers.h | 2 ++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index dc4bfab2acb..0a3a57e5a77 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -473,11 +473,42 @@ ShadowLayerForwarder::RemoveTextureFromCompositableAsync(AsyncTransactionTracker aAsyncTransactionTracker); } +bool +ShadowLayerForwarder::InWorkerThread() +{ + return GetMessageLoop()->id() == MessageLoop::current()->id(); +} + +static void RemoveTextureWorker(TextureClient* aTexture, ReentrantMonitor* aBarrier, bool* aDone) +{ + aTexture->ForceRemove(); + + ReentrantMonitorAutoEnter autoMon(*aBarrier); + *aDone = true; + aBarrier->NotifyAll(); +} + void ShadowLayerForwarder::RemoveTexture(TextureClient* aTexture) { MOZ_ASSERT(aTexture); - aTexture->ForceRemove(); + if (InWorkerThread()) { + aTexture->ForceRemove(); + return; + } + + ReentrantMonitor barrier("ShadowLayerForwarder::RemoveTexture Lock"); + ReentrantMonitorAutoEnter autoMon(barrier); + bool done = false; + + GetMessageLoop()->PostTask( + FROM_HERE, + NewRunnableFunction(&RemoveTextureWorker, aTexture, &barrier, &done)); + + // Wait until the TextureClient has been ForceRemoved on the worker thread + while (!done) { + barrier.Wait(); + } } bool diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index 452c169852f..24e01d5e835 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -393,6 +393,8 @@ protected: void CheckSurfaceDescriptor(const SurfaceDescriptor* aDescriptor) const {} #endif + bool InWorkerThread(); + RefPtr mShadowManager; private: From 078eac0bfb6ebdf0218fdbd5a84bf699acfc3bc4 Mon Sep 17 00:00:00 2001 From: Arnaud Bienner Date: Tue, 5 Aug 2014 20:25:46 +0200 Subject: [PATCH 003/100] Bug 1047823 - Use a default value when getting CPPFLAGS from environment if they aren't set. r=glandium --- python/mozbuild/mozbuild/backend/cpp_eclipse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/mozbuild/mozbuild/backend/cpp_eclipse.py b/python/mozbuild/mozbuild/backend/cpp_eclipse.py index f8badac7e41..090dc66f199 100644 --- a/python/mozbuild/mozbuild/backend/cpp_eclipse.py +++ b/python/mozbuild/mozbuild/backend/cpp_eclipse.py @@ -34,7 +34,7 @@ class CppEclipseBackend(CommonBackend): self._bin_suffix = self.environment.substs['BIN_SUFFIX'] self._cxx = self.environment.substs['CXX'] # Note: We need the C Pre Processor (CPP) flags, not the CXX flags - self._cppflags = self.environment.substs['CPPFLAGS'] + self._cppflags = self.environment.substs.get('CPPFLAGS', '') def detailed(summary): return ('\n' + \ From 2c3b4a95904467e745d99ad092279c46599ebebc Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Wed, 6 Aug 2014 21:30:00 -0700 Subject: [PATCH 004/100] Bug 1050103 - Mark netwerk/srtp as FAIL_ON_WARNINGS. r=rjesup a=kwierso --- netwerk/srtp/src/moz.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/netwerk/srtp/src/moz.build b/netwerk/srtp/src/moz.build index cc9f2a6d354..3fe725ab3c8 100644 --- a/netwerk/srtp/src/moz.build +++ b/netwerk/srtp/src/moz.build @@ -68,3 +68,5 @@ if CONFIG['OS_TARGET'] == 'WINNT': if CONFIG['GNU_CC']: CFLAGS += ['-std=gnu99'] + +FAIL_ON_WARNINGS = True From 00ca958798a9f1a81219bb51082a07eb30152e01 Mon Sep 17 00:00:00 2001 From: Martijn Wargers Date: Wed, 6 Aug 2014 16:37:08 -0700 Subject: [PATCH 005/100] Bug 928678 - Hopeful fix for intermittent failure. r=jmaher --- content/html/content/test/file_iframe_sandbox_e_if6.html | 2 -- content/html/content/test/file_iframe_sandbox_form_pass.html | 2 -- 2 files changed, 4 deletions(-) diff --git a/content/html/content/test/file_iframe_sandbox_e_if6.html b/content/html/content/test/file_iframe_sandbox_e_if6.html index 1da58381189..b1266416cbb 100644 --- a/content/html/content/test/file_iframe_sandbox_e_if6.html +++ b/content/html/content/test/file_iframe_sandbox_e_if6.html @@ -3,9 +3,7 @@ Test for Bug 341604 - - - From a0cb588368952f9ecba6e10c7d0f72c8af9b561a Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Thu, 7 Aug 2014 17:45:08 -0700 Subject: [PATCH 006/100] Bug 966362 - Fix copy/paste error to fix typo in gfx2d. r=Bas --- gfx/2d/ImageScalingSSE2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/2d/ImageScalingSSE2.cpp b/gfx/2d/ImageScalingSSE2.cpp index f87653b4cab..92bad43a17f 100644 --- a/gfx/2d/ImageScalingSSE2.cpp +++ b/gfx/2d/ImageScalingSSE2.cpp @@ -248,7 +248,7 @@ ImageHalfScaler::HalfImageVertical_SSE2(uint8_t *aSource, int32_t aSourceStride, *storage++ = avg_sse2_4x2_4x1(a, b); } - } else if (!(uintptr_t(aSource + (y * aSourceStride)) % 16)) { + } else if (!(uintptr_t(aSource + ((y + 1) * aSourceStride)) % 16)) { for (; x < (aSourceSize.width - 3); x += 4) { uint8_t *upperRow = aSource + (y * aSourceStride + x * 4); uint8_t *lowerRow = aSource + ((y + 1) * aSourceStride + x * 4); From 326492814bc09770b5bacb768be4a40758400eb1 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Thu, 7 Aug 2014 17:45:14 -0700 Subject: [PATCH 007/100] Bug 1032511 - URLSearchParam should decode any non-unicode input correctly, r=hsivonen --- dom/base/URLSearchParams.cpp | 62 +++++++++++++++++--- dom/base/URLSearchParams.h | 5 +- dom/base/test/mochitest.ini | 1 + dom/base/test/test_urlSearchParams_utf8.html | 40 +++++++++++++ 4 files changed, 98 insertions(+), 10 deletions(-) create mode 100644 dom/base/test/test_urlSearchParams_utf8.html diff --git a/dom/base/URLSearchParams.cpp b/dom/base/URLSearchParams.cpp index 2092146d7f0..7551a48747d 100644 --- a/dom/base/URLSearchParams.cpp +++ b/dom/base/URLSearchParams.cpp @@ -5,6 +5,7 @@ #include "URLSearchParams.h" #include "mozilla/dom/URLSearchParamsBinding.h" +#include "mozilla/dom/EncodingUtils.h" namespace mozilla { namespace dom { @@ -98,30 +99,31 @@ URLSearchParams::ParseInput(const nsACString& aInput, name.Assign(string); } - nsAutoCString decodedName; + nsAutoString decodedName; DecodeString(name, decodedName); - nsAutoCString decodedValue; + nsAutoString decodedValue; DecodeString(value, decodedValue); - AppendInternal(NS_ConvertUTF8toUTF16(decodedName), - NS_ConvertUTF8toUTF16(decodedValue)); + AppendInternal(decodedName, decodedValue); } NotifyObservers(aObserver); } void -URLSearchParams::DecodeString(const nsACString& aInput, nsACString& aOutput) +URLSearchParams::DecodeString(const nsACString& aInput, nsAString& aOutput) { nsACString::const_iterator start, end; aInput.BeginReading(start); aInput.EndReading(end); + nsCString unescaped; + while (start != end) { // replace '+' with U+0020 if (*start == '+') { - aOutput.Append(' '); + unescaped.Append(' '); ++start; continue; } @@ -148,20 +150,62 @@ URLSearchParams::DecodeString(const nsACString& aInput, nsACString& aOutput) if (first != end && second != end && ASCII_HEX_DIGIT(*first) && ASCII_HEX_DIGIT(*second)) { - aOutput.Append(HEX_DIGIT(first) * 16 + HEX_DIGIT(second)); + unescaped.Append(HEX_DIGIT(first) * 16 + HEX_DIGIT(second)); start = ++second; continue; } else { - aOutput.Append('%'); + unescaped.Append('%'); ++start; continue; } } - aOutput.Append(*start); + unescaped.Append(*start); ++start; } + + ConvertString(unescaped, aOutput); +} + +void +URLSearchParams::ConvertString(const nsACString& aInput, nsAString& aOutput) +{ + aOutput.Truncate(); + + if (!mDecoder) { + mDecoder = EncodingUtils::DecoderForEncoding("UTF-8"); + if (!mDecoder) { + MOZ_ASSERT(mDecoder, "Failed to create a decoder."); + return; + } + } + + nsACString::const_iterator iter; + aInput.BeginReading(iter); + + int32_t inputLength = aInput.Length(); + int32_t outputLength = 0; + + nsresult rv = mDecoder->GetMaxLength(iter.get(), inputLength, + &outputLength); + if (NS_WARN_IF(NS_FAILED(rv))) { + return; + } + + const mozilla::fallible_t fallible = mozilla::fallible_t(); + nsAutoArrayPtr buf(new (fallible) char16_t[outputLength + 1]); + if (!buf) { + return; + } + + rv = mDecoder->Convert(iter.get(), &inputLength, buf, &outputLength); + if (NS_SUCCEEDED(rv)) { + buf[outputLength] = 0; + if (!aOutput.Assign(buf, outputLength, mozilla::fallible_t())) { + aOutput.Truncate(); + } + } } /* static */ PLDHashOperator diff --git a/dom/base/URLSearchParams.h b/dom/base/URLSearchParams.h index 92168f0dddc..1424d36aed3 100644 --- a/dom/base/URLSearchParams.h +++ b/dom/base/URLSearchParams.h @@ -13,6 +13,7 @@ #include "nsClassHashtable.h" #include "nsHashKeys.h" #include "nsISupports.h" +#include "nsIUnicodeDecoder.h" namespace mozilla { namespace dom { @@ -83,7 +84,8 @@ private: void DeleteAll(); - void DecodeString(const nsACString& aInput, nsACString& aOutput); + void DecodeString(const nsACString& aInput, nsAString& aOutput); + void ConvertString(const nsACString& aInput, nsAString& aOutput); void NotifyObservers(URLSearchParamsObserver* aExceptObserver); @@ -98,6 +100,7 @@ private: nsClassHashtable> mSearchParams; nsTArray> mObservers; + nsCOMPtr mDecoder; }; } // namespace dom diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index c2ce933b424..598997096d0 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -74,6 +74,7 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop spec [test_url_malformedHost.html] [test_urlExceptions.html] [test_urlSearchParams.html] +[test_urlSearchParams_utf8.html] [test_urlutils_stringify.html] [test_window_constructor.html] [test_window_cross_origin_props.html] diff --git a/dom/base/test/test_urlSearchParams_utf8.html b/dom/base/test/test_urlSearchParams_utf8.html new file mode 100644 index 00000000000..22c85de45b8 --- /dev/null +++ b/dom/base/test/test_urlSearchParams_utf8.html @@ -0,0 +1,40 @@ + + + + + + + Test for Bug 1032511 + + + + +Mozilla Bug 1032511 +

+ +
+
+foobar +foobar + + + From 14fd85afcccf8c86f8a716707517f5add597fe99 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Thu, 7 Aug 2014 17:45:21 -0700 Subject: [PATCH 008/100] Bug 1037715 - Implement .searchParams on Location, r=bz, r=ehsan --- content/base/src/Link.cpp | 3 +- content/base/src/Link.h | 2 +- docshell/base/nsDocShell.cpp | 30 ++++ docshell/base/nsDocShell.h | 4 + docshell/base/nsIDocShell.idl | 13 +- dom/base/URL.cpp | 3 +- dom/base/URL.h | 2 +- dom/base/URLSearchParams.cpp | 8 +- dom/base/URLSearchParams.h | 5 +- dom/base/nsLocation.cpp | 148 +++++++++++++++++- dom/base/nsLocation.h | 20 ++- dom/base/test/mochitest.ini | 1 + dom/base/test/test_location_searchParams.html | 89 +++++++++++ dom/webidl/Location.webidl | 2 +- dom/webidl/URLUtils.webidl | 13 +- dom/workers/URL.cpp | 3 +- dom/workers/URL.h | 2 +- .../components/places/tests/cpp/mock_Link.h | 2 +- 18 files changed, 327 insertions(+), 23 deletions(-) create mode 100644 dom/base/test/test_location_searchParams.html diff --git a/content/base/src/Link.cpp b/content/base/src/Link.cpp index 21f10cf3c1d..9506551441e 100644 --- a/content/base/src/Link.cpp +++ b/content/base/src/Link.cpp @@ -596,9 +596,10 @@ Link::SetSearchParams(URLSearchParams& aSearchParams) } void -Link::URLSearchParamsUpdated() +Link::URLSearchParamsUpdated(URLSearchParams* aSearchParams) { MOZ_ASSERT(mSearchParams); + MOZ_ASSERT(mSearchParams == aSearchParams); nsString search; mSearchParams->Serialize(search); diff --git a/content/base/src/Link.h b/content/base/src/Link.h index 9ade6e49527..ae004767292 100644 --- a/content/base/src/Link.h +++ b/content/base/src/Link.h @@ -115,7 +115,7 @@ public: bool ElementHasHref() const; // URLSearchParamsObserver - void URLSearchParamsUpdated() MOZ_OVERRIDE; + void URLSearchParamsUpdated(URLSearchParams* aSearchParams) MOZ_OVERRIDE; protected: virtual ~Link(); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index c49a33d927c..bca80b07ac2 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -192,6 +192,7 @@ #include "nsIWidget.h" #include "mozilla/dom/EncodingUtils.h" #include "mozilla/dom/ScriptSettings.h" +#include "mozilla/dom/URLSearchParams.h" static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); @@ -1932,6 +1933,24 @@ nsDocShell::SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest, mLSHE->GetIsSubFrame(&isSubFrame); } + // nsDocShell owns a URLSearchParams that is used by + // window.location.searchParams to be in sync with the current location. + if (!mURLSearchParams) { + mURLSearchParams = new URLSearchParams(); + } + + nsAutoCString search; + + nsCOMPtr url(do_QueryInterface(mCurrentURI)); + if (url) { + nsresult rv = url->GetQuery(search); + if (NS_FAILED(rv)) { + NS_WARNING("Failed to get the query from a nsIURL."); + } + } + + mURLSearchParams->ParseInput(search, nullptr); + if (!isSubFrame && !isRoot) { /* * We don't want to send OnLocationChange notifications when @@ -5348,6 +5367,11 @@ nsDocShell::Destroy() mParentWidget = nullptr; mCurrentURI = nullptr; + if (mURLSearchParams) { + mURLSearchParams->RemoveObservers(); + mURLSearchParams = nullptr; + } + if (mScriptGlobal) { mScriptGlobal->DetachFromDocShell(); mScriptGlobal = nullptr; @@ -13187,3 +13211,9 @@ nsDocShell::GetOpenedRemote() nsCOMPtr openedRemote(do_QueryReferent(mOpenedRemote)); return openedRemote; } + +URLSearchParams* +nsDocShell::GetURLSearchParams() +{ + return mURLSearchParams; +} diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 9b697bff8a7..82b93bcfb7c 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -50,6 +50,7 @@ namespace mozilla { namespace dom { class EventTarget; +class URLSearchParams; } } @@ -763,6 +764,9 @@ protected: nsCOMPtr mFailedChannel; uint32_t mFailedLoadType; + // window.location.searchParams is updated in sync with this object. + nsRefPtr mURLSearchParams; + // Set in DoURILoad when either the LOAD_RELOAD_ALLOW_MIXED_CONTENT flag or // the LOAD_NORMAL_ALLOW_MIXED_CONTENT flag is set. // Checked in nsMixedContentBlocker, to see if the channels match. diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index f9daf4e7190..18efa0c96c0 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -11,6 +11,13 @@ #include "js/TypeDecls.h" class nsPresContext; class nsIPresShell; + +namespace mozilla { +namespace dom { +class URLSearchParams; +} +} + %} /** @@ -19,6 +26,7 @@ class nsIPresShell; [ptr] native nsPresContext(nsPresContext); [ptr] native nsIPresShell(nsIPresShell); +[ptr] native URLSearchParams(mozilla::dom::URLSearchParams); interface nsIURI; interface nsIChannel; @@ -46,7 +54,7 @@ interface nsITabParent; typedef unsigned long nsLoadFlags; -[scriptable, builtinclass, uuid(e5fe5c76-e511-4da3-9709-f8294b8dc5ce)] +[scriptable, builtinclass, uuid(8ccc5a61-e053-4851-ab00-dadab0dffd7f)] interface nsIDocShell : nsIDocShellTreeItem { /** @@ -982,4 +990,7 @@ interface nsIDocShell : nsIDocShellTreeItem */ [noscript,notxpcom,nostdcall] void setOpenedRemote(in nsITabParent aOpenedRemote); [noscript,notxpcom,nostdcall] nsITabParent getOpenedRemote(); + + // URLSearchParams for the window.location is owned by the docShell. + [noscript,notxpcom] URLSearchParams getURLSearchParams(); }; diff --git a/dom/base/URL.cpp b/dom/base/URL.cpp index 80fe487d847..7a73c265e7e 100644 --- a/dom/base/URL.cpp +++ b/dom/base/URL.cpp @@ -341,9 +341,10 @@ URL::SetHost(const nsAString& aHost, ErrorResult& aRv) } void -URL::URLSearchParamsUpdated() +URL::URLSearchParamsUpdated(URLSearchParams* aSearchParams) { MOZ_ASSERT(mSearchParams); + MOZ_ASSERT(mSearchParams == aSearchParams); nsAutoString search; mSearchParams->Serialize(search); diff --git a/dom/base/URL.h b/dom/base/URL.h index 1ed7b85dcbc..23cfa85e0d8 100644 --- a/dom/base/URL.h +++ b/dom/base/URL.h @@ -121,7 +121,7 @@ public: } // URLSearchParamsObserver - void URLSearchParamsUpdated() MOZ_OVERRIDE; + void URLSearchParamsUpdated(URLSearchParams* aSearchParams) MOZ_OVERRIDE; private: nsIURI* GetURI() const diff --git a/dom/base/URLSearchParams.cpp b/dom/base/URLSearchParams.cpp index 7551a48747d..dc9d22e9e81 100644 --- a/dom/base/URLSearchParams.cpp +++ b/dom/base/URLSearchParams.cpp @@ -237,6 +237,12 @@ URLSearchParams::RemoveObserver(URLSearchParamsObserver* aObserver) mObservers.RemoveElement(aObserver); } +void +URLSearchParams::RemoveObservers() +{ + mObservers.Clear(); +} + void URLSearchParams::Get(const nsAString& aName, nsString& aRetval) { @@ -387,7 +393,7 @@ URLSearchParams::NotifyObservers(URLSearchParamsObserver* aExceptObserver) { for (uint32_t i = 0; i < mObservers.Length(); ++i) { if (mObservers[i] != aExceptObserver) { - mObservers[i]->URLSearchParamsUpdated(); + mObservers[i]->URLSearchParamsUpdated(this); } } } diff --git a/dom/base/URLSearchParams.h b/dom/base/URLSearchParams.h index 1424d36aed3..e141f53ddd2 100644 --- a/dom/base/URLSearchParams.h +++ b/dom/base/URLSearchParams.h @@ -18,12 +18,14 @@ namespace mozilla { namespace dom { +class URLSearchParams; + class URLSearchParamsObserver : public nsISupports { public: virtual ~URLSearchParamsObserver() {} - virtual void URLSearchParamsUpdated() = 0; + virtual void URLSearchParamsUpdated(URLSearchParams* aFromThis) = 0; }; class URLSearchParams MOZ_FINAL : public nsISupports, @@ -59,6 +61,7 @@ public: void AddObserver(URLSearchParamsObserver* aObserver); void RemoveObserver(URLSearchParamsObserver* aObserver); + void RemoveObservers(); void Serialize(nsAString& aValue) const; diff --git a/dom/base/nsLocation.cpp b/dom/base/nsLocation.cpp index 7012d500176..d16e6c72080 100644 --- a/dom/base/nsLocation.cpp +++ b/dom/base/nsLocation.cpp @@ -68,16 +68,33 @@ nsLocation::nsLocation(nsPIDOMWindow* aWindow, nsIDocShell *aDocShell) nsLocation::~nsLocation() { + RemoveURLSearchParams(); } // QueryInterface implementation for nsLocation NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsLocation) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_INTERFACE_MAP_ENTRY(nsIDOMLocation) - NS_INTERFACE_MAP_ENTRY(nsISupports) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMLocation) NS_INTERFACE_MAP_END -NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsLocation, mInnerWindow) +NS_IMPL_CYCLE_COLLECTION_CLASS(nsLocation) + +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsLocation) + tmp->RemoveURLSearchParams(); + + NS_IMPL_CYCLE_COLLECTION_UNLINK(mInnerWindow); + NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER +NS_IMPL_CYCLE_COLLECTION_UNLINK_END + +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsLocation) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSearchParams) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mInnerWindow) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END + +NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(nsLocation) + NS_IMPL_CYCLE_COLLECTING_ADDREF(nsLocation) NS_IMPL_CYCLE_COLLECTING_RELEASE(nsLocation) @@ -858,6 +875,17 @@ nsLocation::GetSearch(nsAString& aSearch) NS_IMETHODIMP nsLocation::SetSearch(const nsAString& aSearch) +{ + nsresult rv = SetSearchInternal(aSearch); + if (NS_FAILED(rv)) { + return rv; + } + + return NS_OK; +} + +nsresult +nsLocation::SetSearchInternal(const nsAString& aSearch) { if (!CallerSubsumes()) return NS_ERROR_DOM_SECURITY_ERR; @@ -1036,3 +1064,119 @@ nsLocation::WrapObject(JSContext* aCx) { return LocationBinding::Wrap(aCx, this); } + +URLSearchParams* +nsLocation::GetDocShellSearchParams() +{ + nsCOMPtr docShell = GetDocShell(); + if (!docShell) { + return nullptr; + } + + return docShell->GetURLSearchParams(); +} + +URLSearchParams* +nsLocation::SearchParams() +{ + if (!mSearchParams) { + // We must register this object to the URLSearchParams of the docshell in + // order to receive updates. + nsRefPtr searchParams = GetDocShellSearchParams(); + if (searchParams) { + searchParams->AddObserver(this); + } + + mSearchParams = new URLSearchParams(); + mSearchParams->AddObserver(this); + UpdateURLSearchParams(); + } + + return mSearchParams; +} + +void +nsLocation::SetSearchParams(URLSearchParams& aSearchParams) +{ + if (mSearchParams) { + mSearchParams->RemoveObserver(this); + } + + // the observer will be cleared using the cycle collector. + mSearchParams = &aSearchParams; + mSearchParams->AddObserver(this); + + nsAutoString search; + mSearchParams->Serialize(search); + SetSearchInternal(search); + + // We don't need to inform the docShell about this new SearchParams because + // setting the new value the docShell will refresh its value automatically. +} + +void +nsLocation::URLSearchParamsUpdated(URLSearchParams* aSearchParams) +{ + MOZ_ASSERT(mSearchParams); + + // This change comes from content. + if (aSearchParams == mSearchParams) { + nsAutoString search; + mSearchParams->Serialize(search); + SetSearchInternal(search); + return; + } + + // This change comes from the docShell. +#ifdef DEBUG + { + nsRefPtr searchParams = GetDocShellSearchParams(); + MOZ_ASSERT(searchParams); + MOZ_ASSERT(aSearchParams == searchParams); + } +#endif + + nsAutoString search; + aSearchParams->Serialize(search); + mSearchParams->ParseInput(NS_ConvertUTF16toUTF8(search), this); +} + +void +nsLocation::UpdateURLSearchParams() +{ + if (!mSearchParams) { + return; + } + + nsAutoCString search; + + nsCOMPtr uri; + nsresult rv = GetURI(getter_AddRefs(uri)); + if (NS_WARN_IF(NS_FAILED(rv)) || NS_WARN_IF(!uri)) { + return; + } + + nsCOMPtr url(do_QueryInterface(uri)); + if (url) { + nsresult rv = url->GetQuery(search); + if (NS_FAILED(rv)) { + NS_WARNING("Failed to get the query from a nsIURL."); + } + } + + mSearchParams->ParseInput(search, this); +} + +void +nsLocation::RemoveURLSearchParams() +{ + if (mSearchParams) { + mSearchParams->RemoveObserver(this); + mSearchParams = nullptr; + + nsRefPtr docShellSearchParams = GetDocShellSearchParams(); + if (docShellSearchParams) { + docShellSearchParams->RemoveObserver(this); + } + } +} diff --git a/dom/base/nsLocation.h b/dom/base/nsLocation.h index f3fc3b4d73e..8bc58f6f354 100644 --- a/dom/base/nsLocation.h +++ b/dom/base/nsLocation.h @@ -14,6 +14,7 @@ #include "nsCycleCollectionParticipant.h" #include "js/TypeDecls.h" #include "mozilla/ErrorResult.h" +#include "mozilla/dom/URLSearchParams.h" #include "nsPIDOMWindow.h" class nsIURI; @@ -26,6 +27,7 @@ class nsIDocShellLoadInfo; class nsLocation MOZ_FINAL : public nsIDOMLocation , public nsWrapperCache + , public mozilla::dom::URLSearchParamsObserver { typedef mozilla::ErrorResult ErrorResult; @@ -33,7 +35,8 @@ public: nsLocation(nsPIDOMWindow* aWindow, nsIDocShell *aDocShell); NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsLocation) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsLocation, + nsIDOMLocation) void SetDocShell(nsIDocShell *aDocShell); nsIDocShell *GetDocShell(); @@ -118,6 +121,11 @@ public: { aError = SetSearch(aSeach); } + + mozilla::dom::URLSearchParams* SearchParams(); + + void SetSearchParams(mozilla::dom::URLSearchParams& aSearchParams); + void GetHash(nsAString& aHash, ErrorResult& aError) { aError = GetHash(aHash); @@ -136,9 +144,18 @@ public: } virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; + // URLSearchParamsObserver + void URLSearchParamsUpdated(mozilla::dom::URLSearchParams* aSearchParams) MOZ_OVERRIDE; + protected: virtual ~nsLocation(); + nsresult SetSearchInternal(const nsAString& aSearch); + void UpdateURLSearchParams(); + void RemoveURLSearchParams(); + + mozilla::dom::URLSearchParams* GetDocShellSearchParams(); + // In the case of jar: uris, we sometimes want the place the jar was // fetched from as the URI instead of the jar: uri itself. Pass in // true for aGetInnermostURI when that's the case. @@ -156,6 +173,7 @@ protected: nsString mCachedHash; nsCOMPtr mInnerWindow; + nsRefPtr mSearchParams; nsWeakPtr mDocShell; }; diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index 598997096d0..c988349f39f 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -47,6 +47,7 @@ skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e1 [test_history_state_null.html] [test_Image_constructor.html] [test_innersize_scrollport.html] +[test_location_searchParams.html] [test_messageChannel.html] [test_messageChannel_cloning.html] [test_messageChannel_pingpong.html] diff --git a/dom/base/test/test_location_searchParams.html b/dom/base/test/test_location_searchParams.html new file mode 100644 index 00000000000..0e7a25d3f92 --- /dev/null +++ b/dom/base/test/test_location_searchParams.html @@ -0,0 +1,89 @@ + + + + + + + Test for Bug 1037715 + + + + + Mozilla Bug 1037715 + + + + + diff --git a/dom/webidl/Location.webidl b/dom/webidl/Location.webidl index 7cc105890d0..59999602010 100644 --- a/dom/webidl/Location.webidl +++ b/dom/webidl/Location.webidl @@ -22,4 +22,4 @@ interface Location { void reload(optional boolean forceget = false); }; // No support for .searchParams on Location yet. See bug 1037715. -Location implements URLUtilsNoSearchParams; +Location implements URLUtils; diff --git a/dom/webidl/URLUtils.webidl b/dom/webidl/URLUtils.webidl index 05cb644e6c5..ad321622014 100644 --- a/dom/webidl/URLUtils.webidl +++ b/dom/webidl/URLUtils.webidl @@ -15,7 +15,7 @@ [NoInterfaceObject, Exposed=(Window, Worker)] -interface URLUtilsNoSearchParams { +interface URLUtils { // Bug 824857: no support for stringifier attributes yet. // stringifier attribute DOMString href; [Throws, CrossOriginWritable=Location] @@ -39,7 +39,9 @@ interface URLUtilsNoSearchParams { attribute DOMString pathname; [Throws] attribute DOMString search; - // searchParams should go here once Location implements it. See bug 1037715. + + attribute URLSearchParams searchParams; + [Throws] attribute DOMString hash; @@ -47,10 +49,3 @@ interface URLUtilsNoSearchParams { [Throws] stringifier; }; - -[NoInterfaceObject, - Exposed=(Window, Worker)] -interface URLUtils : URLUtilsNoSearchParams -{ - attribute URLSearchParams searchParams; -}; diff --git a/dom/workers/URL.cpp b/dom/workers/URL.cpp index 6c031315821..9a44abb0fc8 100644 --- a/dom/workers/URL.cpp +++ b/dom/workers/URL.cpp @@ -894,9 +894,10 @@ URL::RevokeObjectURL(const GlobalObject& aGlobal, const nsAString& aUrl) } void -URL::URLSearchParamsUpdated() +URL::URLSearchParamsUpdated(URLSearchParams* aSearchParams) { MOZ_ASSERT(mSearchParams); + MOZ_ASSERT(mSearchParams == aSearchParams); nsString search; mSearchParams->Serialize(search); diff --git a/dom/workers/URL.h b/dom/workers/URL.h index 50492b61b04..7a7c4755982 100644 --- a/dom/workers/URL.h +++ b/dom/workers/URL.h @@ -119,7 +119,7 @@ public: } // IURLSearchParamsObserver - void URLSearchParamsUpdated() MOZ_OVERRIDE; + void URLSearchParamsUpdated(URLSearchParams* aSearchParams) MOZ_OVERRIDE; private: URLProxy* GetURLProxy() const diff --git a/toolkit/components/places/tests/cpp/mock_Link.h b/toolkit/components/places/tests/cpp/mock_Link.h index 32d53a7ce09..7f049fbebd1 100644 --- a/toolkit/components/places/tests/cpp/mock_Link.h +++ b/toolkit/components/places/tests/cpp/mock_Link.h @@ -118,7 +118,7 @@ Link::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const } void -Link::URLSearchParamsUpdated() +Link::URLSearchParamsUpdated(URLSearchParams* aSearchParams) { NS_NOTREACHED("Unexpected call to Link::URLSearchParamsUpdated"); } From 5e54bcab2ec14870a3bf817b49829ef95b3e7c4e Mon Sep 17 00:00:00 2001 From: Walter Litwinczyk Date: Mon, 4 Aug 2014 16:40:59 -0700 Subject: [PATCH 009/100] Bug 1038899 - WebGL fix attribute and uniform name lookup in WebGLProgram. r=vlad,jgilbert a=kwierso --- dom/canvas/WebGLContextGL.cpp | 3 ++ dom/canvas/WebGLProgram.cpp | 59 ++++++++++++++++++----------------- dom/canvas/WebGLProgram.h | 16 ++++++++++ 3 files changed, 50 insertions(+), 28 deletions(-) diff --git a/dom/canvas/WebGLContextGL.cpp b/dom/canvas/WebGLContextGL.cpp index 759d62c1294..a5b328ec4a9 100644 --- a/dom/canvas/WebGLContextGL.cpp +++ b/dom/canvas/WebGLContextGL.cpp @@ -1967,8 +1967,11 @@ WebGLContext::LinkProgram(WebGLProgram *program) if (program == mCurrentProgram) gl->fUseProgram(progname); } + + program->InitializeUniformAndAttributeMaps(); } else { program->SetLinkStatus(false); + program->ClearUniformAndAttributeMaps(); if (ShouldGenerateWarnings()) { diff --git a/dom/canvas/WebGLProgram.cpp b/dom/canvas/WebGLProgram.cpp index 975f9fd4194..ac9b2be0415 100644 --- a/dom/canvas/WebGLProgram.cpp +++ b/dom/canvas/WebGLProgram.cpp @@ -14,10 +14,10 @@ using namespace mozilla; /** Takes an ASCII string like "foo[i]", turns it into "foo" and returns "[i]" in bracketPart - * + * * \param string input/output: the string to split, becomes the string without the bracket part * \param bracketPart output: gets the bracket part. - * + * * Notice that if there are multiple brackets like "foo[i].bar[j]", only the last bracket is split. */ static bool SplitLastSquareBracket(nsACString& string, nsCString& bracketPart) @@ -134,21 +134,37 @@ WebGLProgram::UpperBoundNumSamplerUniforms() { } void -WebGLProgram::MapIdentifier(const nsACString& name, nsCString *mappedName) { - if (!mIdentifierMap) { - // if the identifier map doesn't exist yet, build it now +WebGLProgram::InitializeUniformAndAttributeMaps() +{ + if (mIdentifierMap) { + mIdentifierMap->Clear(); + } else { mIdentifierMap = new CStringMap; - for (size_t i = 0; i < mAttachedShaders.Length(); i++) { - for (size_t j = 0; j < mAttachedShaders[i]->mAttributes.Length(); j++) { - const WebGLMappedIdentifier& attrib = mAttachedShaders[i]->mAttributes[j]; - mIdentifierMap->Put(attrib.original, attrib.mapped); - } - for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) { - const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j]; - mIdentifierMap->Put(uniform.original, uniform.mapped); - } + } + + if (mIdentifierReverseMap) { + mIdentifierReverseMap->Clear(); + } else { + mIdentifierReverseMap = new CStringMap; + } + + for (size_t i = 0; i < mAttachedShaders.Length(); i++) { + for (size_t j = 0; j < mAttachedShaders[i]->mAttributes.Length(); j++) { + const WebGLMappedIdentifier& attrib = mAttachedShaders[i]->mAttributes[j]; + mIdentifierMap->Put(attrib.original, attrib.mapped); + mIdentifierReverseMap->Put(attrib.mapped, attrib.original); + } + for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) { + const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j]; + mIdentifierMap->Put(uniform.original, uniform.mapped); + mIdentifierReverseMap->Put(uniform.mapped, uniform.original); } } +} + +void +WebGLProgram::MapIdentifier(const nsACString& name, nsCString *mappedName) { + MOZ_ASSERT(mIdentifierMap); nsCString mutableName(name); nsCString bracketPart; @@ -180,20 +196,7 @@ WebGLProgram::MapIdentifier(const nsACString& name, nsCString *mappedName) { void WebGLProgram::ReverseMapIdentifier(const nsACString& name, nsCString *reverseMappedName) { - if (!mIdentifierReverseMap) { - // if the identifier reverse map doesn't exist yet, build it now - mIdentifierReverseMap = new CStringMap; - for (size_t i = 0; i < mAttachedShaders.Length(); i++) { - for (size_t j = 0; j < mAttachedShaders[i]->mAttributes.Length(); j++) { - const WebGLMappedIdentifier& attrib = mAttachedShaders[i]->mAttributes[j]; - mIdentifierReverseMap->Put(attrib.mapped, attrib.original); - } - for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) { - const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j]; - mIdentifierReverseMap->Put(uniform.mapped, uniform.original); - } - } - } + MOZ_ASSERT(mIdentifierReverseMap); nsCString mutableName(name); nsCString bracketPart; diff --git a/dom/canvas/WebGLProgram.h b/dom/canvas/WebGLProgram.h index ddd2cb0f00d..103807a0b28 100644 --- a/dom/canvas/WebGLProgram.h +++ b/dom/canvas/WebGLProgram.h @@ -81,6 +81,22 @@ public: /* Getters for cached program info */ bool IsAttribInUse(unsigned i) const { return mAttribsInUse[i]; } + /* Initialize the maps used by MapIdentifier and ReverseMapIdentifier. This should + * be called after each time the program has been successfully linked. + */ + void InitializeUniformAndAttributeMaps(); + + /* Clear the maps used by MapIdentifier and ReverseMapIdentifier. This should be + * called each time the program has failed to link. + */ + void ClearUniformAndAttributeMaps() { + if (mIdentifierMap) + mIdentifierMap->Clear(); + + if (mIdentifierReverseMap) + mIdentifierReverseMap->Clear(); + } + /* Maps identifier |name| to the mapped identifier |*mappedName| * Both are ASCII strings. */ From 2b9dba8213ea1b060deb21e73d68817fa741ba47 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 7 Aug 2014 19:46:08 -0400 Subject: [PATCH 010/100] Bug 1048241 follow-up: Land a hunk which was missing from the rebase --HG-- extra : rebase_source : 464405c097acd592b64bbb6e76337ba3f44659bd --- widget/MouseEvents.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widget/MouseEvents.h b/widget/MouseEvents.h index 02b17cbbdb3..b3efd3d1c57 100644 --- a/widget/MouseEvents.h +++ b/widget/MouseEvents.h @@ -585,7 +585,7 @@ public: UpdateFlags(); } - WidgetPointerEvent(const WidgetMouseEvent& aEvent) + explicit WidgetPointerEvent(const WidgetMouseEvent& aEvent) : WidgetMouseEvent(aEvent) , width(0) , height(0) From 687e715ee1e34cb149fbafb10e07906cbf1832af Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 7 Aug 2014 19:47:28 -0400 Subject: [PATCH 011/100] Bug 1048272 - Fix some bad implicit constructors in storage; r=mak --HG-- extra : rebase_source : 5fe5099a330cf53fda89f47e76429f1c16f19b06 --- storage/public/StatementCache.h | 2 +- storage/public/mozStorageHelper.h | 2 +- storage/src/SQLiteMutex.h | 6 +++--- storage/src/TelemetryVFS.cpp | 4 ++-- storage/src/VacuumManager.cpp | 2 +- storage/src/Variant.h | 2 +- storage/src/mozStorageAsyncStatementParams.h | 2 +- storage/src/mozStorageBindingParams.h | 4 ++-- storage/src/mozStorageBindingParamsArray.h | 2 +- storage/src/mozStoragePrivateHelpers.cpp | 2 +- storage/src/mozStorageSQLFunctions.cpp | 2 +- storage/src/mozStorageStatementParams.h | 2 +- storage/src/mozStorageStatementRow.h | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/storage/public/StatementCache.h b/storage/public/StatementCache.h index 145e46c0d72..a7f53787307 100644 --- a/storage/public/StatementCache.h +++ b/storage/public/StatementCache.h @@ -35,7 +35,7 @@ public: * used for. This nsCOMPtr must at least live as long as this class, * otherwise crashes will happen. */ - StatementCache(nsCOMPtr& aConnection) + explicit StatementCache(nsCOMPtr& aConnection) : mConnection(aConnection) { } diff --git a/storage/public/mozStorageHelper.h b/storage/public/mozStorageHelper.h index e7322042327..a4ecda8f7c5 100644 --- a/storage/public/mozStorageHelper.h +++ b/storage/public/mozStorageHelper.h @@ -150,7 +150,7 @@ mozStorageTransaction; class MOZ_STACK_CLASS mozStorageStatementScoper { public: - mozStorageStatementScoper(mozIStorageStatement* aStatement) + explicit mozStorageStatementScoper(mozIStorageStatement* aStatement) : mStatement(aStatement) { } diff --git a/storage/src/SQLiteMutex.h b/storage/src/SQLiteMutex.h index 295577b4673..0c1a68cefa5 100644 --- a/storage/src/SQLiteMutex.h +++ b/storage/src/SQLiteMutex.h @@ -29,7 +29,7 @@ public: * @param aName * A name which can be used to reference this mutex. */ - SQLiteMutex(const char *aName) + explicit SQLiteMutex(const char *aName) : BlockingResourceBase(aName, eMutex) , mMutex(nullptr) { @@ -131,7 +131,7 @@ private: class MOZ_STACK_CLASS SQLiteMutexAutoLock { public: - SQLiteMutexAutoLock(SQLiteMutex &aMutex) + explicit SQLiteMutexAutoLock(SQLiteMutex &aMutex) : mMutex(aMutex) { mMutex.lock(); @@ -153,7 +153,7 @@ private: class MOZ_STACK_CLASS SQLiteMutexAutoUnlock { public: - SQLiteMutexAutoUnlock(SQLiteMutex &aMutex) + explicit SQLiteMutexAutoUnlock(SQLiteMutex &aMutex) : mMutex(aMutex) { mMutex.unlock(); diff --git a/storage/src/TelemetryVFS.cpp b/storage/src/TelemetryVFS.cpp index bcb4fd9fd02..9929d1b99c3 100644 --- a/storage/src/TelemetryVFS.cpp +++ b/storage/src/TelemetryVFS.cpp @@ -78,7 +78,7 @@ public: * IOInterposer. Filename will be reported as NULL, and reference will be * either "sqlite-mainthread" or "sqlite-otherthread". */ - IOThreadAutoTimer(Telemetry::ID id, + explicit IOThreadAutoTimer(Telemetry::ID id, IOInterposeObserver::Operation aOp = IOInterposeObserver::OpNone) : start(TimeStamp::Now()), id(id), @@ -92,7 +92,7 @@ public: * * @param aOp IO Operation to report through the IOInterposer. */ - IOThreadAutoTimer(IOInterposeObserver::Operation aOp) + explicit IOThreadAutoTimer(IOInterposeObserver::Operation aOp) : start(TimeStamp::Now()), id(Telemetry::HistogramCount), op(aOp) diff --git a/storage/src/VacuumManager.cpp b/storage/src/VacuumManager.cpp index c5e04c5ae63..f6c229e9328 100644 --- a/storage/src/VacuumManager.cpp +++ b/storage/src/VacuumManager.cpp @@ -109,7 +109,7 @@ class Vacuumer : public BaseCallback public: NS_DECL_MOZISTORAGESTATEMENTCALLBACK - Vacuumer(mozIStorageVacuumParticipant *aParticipant); + explicit Vacuumer(mozIStorageVacuumParticipant *aParticipant); bool execute(); nsresult notifyCompletion(bool aSucceeded); diff --git a/storage/src/Variant.h b/storage/src/Variant.h index 6d9955ecf2f..298825e727d 100644 --- a/storage/src/Variant.h +++ b/storage/src/Variant.h @@ -374,7 +374,7 @@ class Variant : public Variant_base } public: - Variant(const typename variant_storage_traits::ConstructorType aData) + explicit Variant(const typename variant_storage_traits::ConstructorType aData) { variant_storage_traits::storage_conversion(aData, &mData); } diff --git a/storage/src/mozStorageAsyncStatementParams.h b/storage/src/mozStorageAsyncStatementParams.h index c360976068d..9cb1d0449ac 100644 --- a/storage/src/mozStorageAsyncStatementParams.h +++ b/storage/src/mozStorageAsyncStatementParams.h @@ -26,7 +26,7 @@ class AsyncStatementParams MOZ_FINAL : public mozIStorageStatementParams , public nsIXPCScriptable { public: - AsyncStatementParams(AsyncStatement *aStatement); + explicit AsyncStatementParams(AsyncStatement *aStatement); // interfaces NS_DECL_ISUPPORTS diff --git a/storage/src/mozStorageBindingParams.h b/storage/src/mozStorageBindingParams.h index 3608bba84cb..481ba6d2511 100644 --- a/storage/src/mozStorageBindingParams.h +++ b/storage/src/mozStorageBindingParams.h @@ -56,7 +56,7 @@ public: protected: virtual ~BindingParams() {} - BindingParams(mozIStorageBindingParamsArray *aOwningArray); + explicit BindingParams(mozIStorageBindingParamsArray *aOwningArray); nsCOMArray mParameters; bool mLocked; @@ -97,7 +97,7 @@ public: virtual already_AddRefed bind(sqlite3_stmt * aStatement); - AsyncBindingParams(mozIStorageBindingParamsArray *aOwningArray); + explicit AsyncBindingParams(mozIStorageBindingParamsArray *aOwningArray); virtual ~AsyncBindingParams() {} private: diff --git a/storage/src/mozStorageBindingParamsArray.h b/storage/src/mozStorageBindingParamsArray.h index 2f7e7d09e1f..61d16f370b3 100644 --- a/storage/src/mozStorageBindingParamsArray.h +++ b/storage/src/mozStorageBindingParamsArray.h @@ -28,7 +28,7 @@ public: NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEBINDINGPARAMSARRAY - BindingParamsArray(StorageBaseStatementInternal *aOwningStatement); + explicit BindingParamsArray(StorageBaseStatementInternal *aOwningStatement); typedef array_type::size_type size_type; diff --git a/storage/src/mozStoragePrivateHelpers.cpp b/storage/src/mozStoragePrivateHelpers.cpp index 0f014dfe92b..a06681e02d2 100644 --- a/storage/src/mozStoragePrivateHelpers.cpp +++ b/storage/src/mozStoragePrivateHelpers.cpp @@ -158,7 +158,7 @@ namespace { class CallbackEvent : public nsRunnable { public: - CallbackEvent(mozIStorageCompletionCallback *aCallback) + explicit CallbackEvent(mozIStorageCompletionCallback *aCallback) : mCallback(aCallback) { } diff --git a/storage/src/mozStorageSQLFunctions.cpp b/storage/src/mozStorageSQLFunctions.cpp index 3442448abcd..4a3d6f8521d 100644 --- a/storage/src/mozStorageSQLFunctions.cpp +++ b/storage/src/mozStorageSQLFunctions.cpp @@ -131,7 +131,7 @@ template class AutoArray public: - AutoArray(size_t size) + explicit AutoArray(size_t size) : mBuffer(size <= N ? mAutoBuffer : new T[size]) { } diff --git a/storage/src/mozStorageStatementParams.h b/storage/src/mozStorageStatementParams.h index bd60b1fb767..06202ac7993 100644 --- a/storage/src/mozStorageStatementParams.h +++ b/storage/src/mozStorageStatementParams.h @@ -22,7 +22,7 @@ class StatementParams MOZ_FINAL : public mozIStorageStatementParams , public nsIXPCScriptable { public: - StatementParams(mozIStorageStatement *aStatement); + explicit StatementParams(mozIStorageStatement *aStatement); // interfaces NS_DECL_ISUPPORTS diff --git a/storage/src/mozStorageStatementRow.h b/storage/src/mozStorageStatementRow.h index 263e522398c..2f569a0aebc 100644 --- a/storage/src/mozStorageStatementRow.h +++ b/storage/src/mozStorageStatementRow.h @@ -24,7 +24,7 @@ public: NS_DECL_MOZISTORAGESTATEMENTROW NS_DECL_NSIXPCSCRIPTABLE - StatementRow(Statement *aStatement); + explicit StatementRow(Statement *aStatement); protected: ~StatementRow() {} From 3bb4f6f86721e7998a111f5e908eb66d66ebbe4e Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 7 Aug 2014 19:48:38 -0400 Subject: [PATCH 012/100] Bug 1048246 - Fix more bad implicit constructors in layout; r=roc --HG-- extra : rebase_source : ed828993139bc70232508364a9f046e38b7d3e06 --- accessible/generic/HyperTextAccessible.cpp | 4 +++- layout/base/DisplayListClipState.h | 4 ++-- layout/base/FrameLayerBuilder.h | 2 +- layout/base/FramePropertyTable.h | 2 +- layout/base/nsDisplayList.h | 10 +++++----- layout/base/nsDocumentViewer.cpp | 4 ++-- layout/base/nsIPresShell.h | 6 +++--- layout/base/nsLayoutUtils.h | 4 ++-- layout/base/nsPresArena.h | 2 +- layout/base/nsPresContext.h | 4 ++-- layout/base/nsRefreshDriver.h | 2 +- layout/generic/FrameChildList.h | 8 ++++---- layout/generic/Selection.h | 4 ++-- layout/generic/WritingModes.h | 12 ++++++------ layout/generic/nsContainerFrame.h | 2 +- layout/generic/nsFrame.h | 4 ++-- layout/generic/nsFrameList.h | 6 +++--- layout/generic/nsHTMLReflowMetrics.h | 4 ++-- layout/generic/nsIFrame.h | 2 +- layout/generic/nsLeafFrame.h | 2 +- layout/generic/nsQueryFrame.h | 8 +++++++- layout/generic/nsSplittableFrame.h | 2 +- layout/generic/nsSubDocumentFrame.h | 2 +- layout/printing/nsPrintData.h | 2 +- layout/style/CSSStyleSheet.h | 2 +- layout/style/CounterStyleManager.h | 2 +- layout/style/Loader.h | 4 ++-- layout/style/nsCSSScanner.h | 2 +- layout/style/nsCSSValue.h | 10 +++++----- layout/style/nsStyleCoord.h | 2 +- layout/style/nsStyleStruct.h | 20 ++++++++++---------- view/nsView.h | 4 ++-- view/nsViewManager.h | 2 +- 33 files changed, 79 insertions(+), 71 deletions(-) diff --git a/accessible/generic/HyperTextAccessible.cpp b/accessible/generic/HyperTextAccessible.cpp index 4b1e8684d60..96f09f3fb21 100644 --- a/accessible/generic/HyperTextAccessible.cpp +++ b/accessible/generic/HyperTextAccessible.cpp @@ -1546,7 +1546,9 @@ HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartOffset, int16_t hPercent = offsetPointX * 100 / size.width; int16_t vPercent = offsetPointY * 100 / size.height; - nsresult rv = nsCoreUtils::ScrollSubstringTo(frame, range, vPercent, hPercent); + nsresult rv = nsCoreUtils::ScrollSubstringTo(frame, range, + nsIPresShell::ScrollAxis(vPercent), + nsIPresShell::ScrollAxis(hPercent)); if (NS_FAILED(rv)) return; diff --git a/layout/base/DisplayListClipState.h b/layout/base/DisplayListClipState.h index 39630d7f9fc..cd29d2dde72 100644 --- a/layout/base/DisplayListClipState.h +++ b/layout/base/DisplayListClipState.h @@ -131,7 +131,7 @@ private: */ class DisplayListClipState::AutoSaveRestore { public: - AutoSaveRestore(nsDisplayListBuilder* aBuilder); + explicit AutoSaveRestore(nsDisplayListBuilder* aBuilder); void Restore() { mState = mSavedState; @@ -227,7 +227,7 @@ public: */ class DisplayListClipState::AutoClipMultiple : public AutoSaveRestore { public: - AutoClipMultiple(nsDisplayListBuilder* aBuilder) + explicit AutoClipMultiple(nsDisplayListBuilder* aBuilder) : AutoSaveRestore(aBuilder) , mExtraClipUsed(false) {} diff --git a/layout/base/FrameLayerBuilder.h b/layout/base/FrameLayerBuilder.h index b3f2b88a329..1db33c9ed62 100644 --- a/layout/base/FrameLayerBuilder.h +++ b/layout/base/FrameLayerBuilder.h @@ -595,7 +595,7 @@ protected: public: class ThebesLayerItemsEntry : public nsPtrHashKey { public: - ThebesLayerItemsEntry(const ThebesLayer *key) + explicit ThebesLayerItemsEntry(const ThebesLayer *key) : nsPtrHashKey(key) , mContainerLayerFrame(nullptr) , mLastCommonClipCount(0) diff --git a/layout/base/FramePropertyTable.h b/layout/base/FramePropertyTable.h index b8bf6c7dcee..739115b35c3 100644 --- a/layout/base/FramePropertyTable.h +++ b/layout/base/FramePropertyTable.h @@ -192,7 +192,7 @@ protected: class Entry : public nsPtrHashKey { public: - Entry(KeyTypePointer aKey) : nsPtrHashKey(aKey) {} + explicit Entry(KeyTypePointer aKey) : nsPtrHashKey(aKey) {} Entry(const Entry &toCopy) : nsPtrHashKey(toCopy), mProp(toCopy.mProp) {} diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 8f275e39eb7..062f63af216 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -624,7 +624,7 @@ public: : mContainingBlockClip(aContainingBlockClip) , mDirtyRect(aDirtyRect) {} - OutOfFlowDisplayData(const nsRect &aDirtyRect) + explicit OutOfFlowDisplayData(const nsRect &aDirtyRect) : mDirtyRect(aDirtyRect) {} DisplayItemClip mContainingBlockClip; @@ -808,7 +808,7 @@ public: * This constructor is only used in rare cases when we need to construct * temporary items. */ - nsDisplayItem(nsIFrame* aFrame) + explicit nsDisplayItem(nsIFrame* aFrame) : mFrame(aFrame) , mClip(nullptr) , mReferenceFrame(nullptr) @@ -830,7 +830,7 @@ public: struct HitTestState { typedef nsTArray ShadowArray; - HitTestState(ShadowArray* aShadows = nullptr) + explicit HitTestState(ShadowArray* aShadows = nullptr) : mShadows(aShadows) { } @@ -1744,7 +1744,7 @@ struct nsDisplayListCollection : public nsDisplayListSet { nsDisplayListCollection() : nsDisplayListSet(&mLists[0], &mLists[1], &mLists[2], &mLists[3], &mLists[4], &mLists[5]) {} - nsDisplayListCollection(nsDisplayList* aBorderBackground) : + explicit nsDisplayListCollection(nsDisplayList* aBorderBackground) : nsDisplayListSet(aBorderBackground, &mLists[1], &mLists[2], &mLists[3], &mLists[4], &mLists[5]) {} @@ -3412,7 +3412,7 @@ public: nsCharClipDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) : nsDisplayItem(aBuilder, aFrame), mLeftEdge(0), mRightEdge(0) {} - nsCharClipDisplayItem(nsIFrame* aFrame) + explicit nsCharClipDisplayItem(nsIFrame* aFrame) : nsDisplayItem(aFrame) {} struct ClipEdges { diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 92e254b6c7d..98dd7993085 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -427,7 +427,7 @@ protected: class nsPrintEventDispatcher { public: - nsPrintEventDispatcher(nsIDocument* aTop) : mTop(aTop) + explicit nsPrintEventDispatcher(nsIDocument* aTop) : mTop(aTop) { nsDocumentViewer::DispatchBeforePrint(mTop); } @@ -442,7 +442,7 @@ public: class nsDocumentShownDispatcher : public nsRunnable { public: - nsDocumentShownDispatcher(nsCOMPtr aDocument) + explicit nsDocumentShownDispatcher(nsCOMPtr aDocument) : mDocument(aDocument) {} NS_IMETHOD Run() MOZ_OVERRIDE; diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 22767a09fce..10df929885f 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -654,9 +654,9 @@ public: * no scrollbar showing and less than one device pixel of * scrollable distance), don't scroll. Defaults to false. */ - ScrollAxis(int16_t aWhere = SCROLL_MINIMUM, - WhenToScroll aWhen = SCROLL_IF_NOT_FULLY_VISIBLE, - bool aOnlyIfPerceivedScrollableDirection = false) : + explicit ScrollAxis(int16_t aWhere = SCROLL_MINIMUM, + WhenToScroll aWhen = SCROLL_IF_NOT_FULLY_VISIBLE, + bool aOnlyIfPerceivedScrollableDirection = false) : mWhereToScroll(aWhere), mWhenToScroll(aWhen), mOnlyIfPerceivedScrollableDirection(aOnlyIfPerceivedScrollableDirection) {} diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index e4034e905ad..83d55b93a13 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -1000,7 +1000,7 @@ public: struct RectListBuilder : public RectCallback { DOMRectList* mRectList; - RectListBuilder(DOMRectList* aList); + explicit RectListBuilder(DOMRectList* aList); virtual void AddRect(const nsRect& aRect); }; @@ -2346,7 +2346,7 @@ namespace mozilla { */ class AutoMaybeDisableFontInflation { public: - AutoMaybeDisableFontInflation(nsIFrame *aFrame); + explicit AutoMaybeDisableFontInflation(nsIFrame *aFrame); ~AutoMaybeDisableFontInflation(); private: diff --git a/layout/base/nsPresArena.h b/layout/base/nsPresArena.h index 4b667b9eb77..fd44497379a 100644 --- a/layout/base/nsPresArena.h +++ b/layout/base/nsPresArena.h @@ -118,7 +118,7 @@ private: typedef const void* KeyTypePointer; KeyTypePointer mKey; - FreeList(KeyTypePointer aKey) + explicit FreeList(KeyTypePointer aKey) : mEntrySize(0), mEntriesEverAllocated(0), mKey(aKey) {} // Default copy constructor and destructor are ok. diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 5ac784adc4f..2cef783198b 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -937,7 +937,7 @@ public: friend class InterruptPreventer; class MOZ_STACK_CLASS InterruptPreventer { public: - InterruptPreventer(nsPresContext* aCtx) : + explicit InterruptPreventer(nsPresContext* aCtx) : mCtx(aCtx), mInterruptsEnabled(aCtx->mInterruptsEnabled), mHasPendingInterrupt(aCtx->mHasPendingInterrupt) @@ -1492,7 +1492,7 @@ protected: class RunWillPaintObservers : public nsRunnable { public: - RunWillPaintObservers(nsRootPresContext* aPresContext) : mPresContext(aPresContext) {} + explicit RunWillPaintObservers(nsRootPresContext* aPresContext) : mPresContext(aPresContext) {} void Revoke() { mPresContext = nullptr; } NS_IMETHOD Run() MOZ_OVERRIDE { diff --git a/layout/base/nsRefreshDriver.h b/layout/base/nsRefreshDriver.h index 5c51df7b7e2..8de27d5133e 100644 --- a/layout/base/nsRefreshDriver.h +++ b/layout/base/nsRefreshDriver.h @@ -66,7 +66,7 @@ public: class nsRefreshDriver MOZ_FINAL : public mozilla::layers::TransactionIdAllocator, public nsARefreshObserver { public: - nsRefreshDriver(nsPresContext *aPresContext); + explicit nsRefreshDriver(nsPresContext *aPresContext); ~nsRefreshDriver(); static void InitializeStatics(); diff --git a/layout/generic/FrameChildList.h b/layout/generic/FrameChildList.h index 7bf6ba29c9c..34bce1e1f4e 100644 --- a/layout/generic/FrameChildList.h +++ b/layout/generic/FrameChildList.h @@ -26,7 +26,7 @@ friend class FrameChildListIterator; public: FrameChildListIDs() : mIDs(0) {} FrameChildListIDs(const FrameChildListIDs& aOther) : mIDs(aOther.mIDs) {} - FrameChildListIDs(FrameChildListID aListID) : mIDs(aListID) {} + MOZ_IMPLICIT FrameChildListIDs(FrameChildListID aListID) : mIDs(aListID) {} FrameChildListIDs operator|(FrameChildListIDs aOther) const { return FrameChildListIDs(mIDs | aOther.mIDs); @@ -46,7 +46,7 @@ friend class FrameChildListIterator; } protected: - FrameChildListIDs(uint32_t aIDs) : mIDs(aIDs) {} + explicit FrameChildListIDs(uint32_t aIDs) : mIDs(aIDs) {} uint32_t mIDs; }; @@ -63,7 +63,7 @@ class FrameChildList { */ class MOZ_STACK_CLASS FrameChildListArrayIterator { public: - FrameChildListArrayIterator(const nsTArray& aLists) + explicit FrameChildListArrayIterator(const nsTArray& aLists) : mLists(aLists), mCurrentIndex(0) {} bool IsDone() const { return mCurrentIndex >= mLists.Length(); } FrameChildListID CurrentID() const { @@ -90,7 +90,7 @@ protected: class MOZ_STACK_CLASS FrameChildListIterator : public FrameChildListArrayIterator { public: - FrameChildListIterator(const nsIFrame* aFrame); + explicit FrameChildListIterator(const nsIFrame* aFrame); protected: nsAutoTArray mLists; diff --git a/layout/generic/Selection.h b/layout/generic/Selection.h index c0fe97c8791..03ef8f3da76 100644 --- a/layout/generic/Selection.h +++ b/layout/generic/Selection.h @@ -30,7 +30,7 @@ class ErrorResult; struct RangeData { - RangeData(nsRange* aRange) + explicit RangeData(nsRange* aRange) : mRange(aRange) {} @@ -55,7 +55,7 @@ protected: public: Selection(); - Selection(nsFrameSelection *aList); + explicit Selection(nsFrameSelection *aList); NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Selection, nsISelectionPrivate) diff --git a/layout/generic/WritingModes.h b/layout/generic/WritingModes.h index 48208527eb9..40a8ab0f2f5 100644 --- a/layout/generic/WritingModes.h +++ b/layout/generic/WritingModes.h @@ -220,7 +220,7 @@ public: /** * Construct writing mode based on a style context */ - WritingMode(const nsStyleVisibility* aStyleVisibility) + explicit WritingMode(const nsStyleVisibility* aStyleVisibility) { NS_ASSERTION(aStyleVisibility, "we need an nsStyleVisibility here"); @@ -301,7 +301,7 @@ private: * Constructing a WritingMode with an arbitrary value is a private operation * currently only used by the Unknown() static method. */ - WritingMode(uint8_t aValue) + explicit WritingMode(uint8_t aValue) : mWritingMode(aValue) { } @@ -365,7 +365,7 @@ private: */ class LogicalPoint { public: - LogicalPoint(WritingMode aWritingMode) + explicit LogicalPoint(WritingMode aWritingMode) : #ifdef DEBUG mWritingMode(aWritingMode), @@ -569,7 +569,7 @@ private: */ class LogicalSize { public: - LogicalSize(WritingMode aWritingMode) + explicit LogicalSize(WritingMode aWritingMode) : #ifdef DEBUG mWritingMode(aWritingMode), @@ -734,7 +734,7 @@ private: */ class LogicalMargin { public: - LogicalMargin(WritingMode aWritingMode) + explicit LogicalMargin(WritingMode aWritingMode) : #ifdef DEBUG mWritingMode(aWritingMode), @@ -1020,7 +1020,7 @@ private: */ class LogicalRect { public: - LogicalRect(WritingMode aWritingMode) + explicit LogicalRect(WritingMode aWritingMode) : #ifdef DEBUG mWritingMode(aWritingMode), diff --git a/layout/generic/nsContainerFrame.h b/layout/generic/nsContainerFrame.h index d4be9e33ed0..2a9c61af17a 100644 --- a/layout/generic/nsContainerFrame.h +++ b/layout/generic/nsContainerFrame.h @@ -421,7 +421,7 @@ public: NS_DECLARE_FRAME_PROPERTY_FRAMELIST(ExcessOverflowContainersProperty) protected: - nsContainerFrame(nsStyleContext* aContext) : nsSplittableFrame(aContext) {} + explicit nsContainerFrame(nsStyleContext* aContext) : nsSplittableFrame(aContext) {} ~nsContainerFrame(); /** diff --git a/layout/generic/nsFrame.h b/layout/generic/nsFrame.h index e61e0a1574f..aef4767a889 100644 --- a/layout/generic/nsFrame.h +++ b/layout/generic/nsFrame.h @@ -517,7 +517,7 @@ public: protected: // Protected constructor and destructor - nsFrame(nsStyleContext* aContext); + explicit nsFrame(nsStyleContext* aContext); virtual ~nsFrame(); /** @@ -751,7 +751,7 @@ public: }; struct DR_layout_cookie { - DR_layout_cookie(nsIFrame* aFrame); + explicit DR_layout_cookie(nsIFrame* aFrame); ~DR_layout_cookie(); nsIFrame* mFrame; diff --git a/layout/generic/nsFrameList.h b/layout/generic/nsFrameList.h index 904fd1b9f70..b89aaa6353f 100644 --- a/layout/generic/nsFrameList.h +++ b/layout/generic/nsFrameList.h @@ -299,7 +299,7 @@ public: public: // Implicit on purpose, so that we can easily create enumerators from // nsFrameList via this impicit constructor. - Slice(const nsFrameList& aList) : + MOZ_IMPLICIT Slice(const nsFrameList& aList) : #ifdef DEBUG mList(aList), #endif @@ -334,7 +334,7 @@ public: class Enumerator { public: - Enumerator(const Slice& aSlice) : + explicit Enumerator(const Slice& aSlice) : #ifdef DEBUG mSlice(aSlice), #endif @@ -415,7 +415,7 @@ public: public: friend class nsFrameList; - FrameLinkEnumerator(const nsFrameList& aList) : + explicit FrameLinkEnumerator(const nsFrameList& aList) : Enumerator(aList), mPrev(nullptr) {} diff --git a/layout/generic/nsHTMLReflowMetrics.h b/layout/generic/nsHTMLReflowMetrics.h index 2b0e23d75f3..de611bf05ec 100644 --- a/layout/generic/nsHTMLReflowMetrics.h +++ b/layout/generic/nsHTMLReflowMetrics.h @@ -204,7 +204,7 @@ public: // XXX width/height/ascent are OUT parameters and so they shouldn't // have to be initialized, but there are some bad frame classes that // aren't properly setting them when returning from Reflow()... - nsHTMLReflowMetrics(mozilla::WritingMode aWritingMode, uint32_t aFlags = 0) + explicit nsHTMLReflowMetrics(mozilla::WritingMode aWritingMode, uint32_t aFlags = 0) : mISize(0) , mBSize(0) , mBlockStartAscent(ASK_FOR_BASELINE) @@ -212,7 +212,7 @@ public: , mWritingMode(aWritingMode) {} - nsHTMLReflowMetrics(const nsHTMLReflowState& aState, uint32_t aFlags = 0); + explicit nsHTMLReflowMetrics(const nsHTMLReflowState& aState, uint32_t aFlags = 0); // ISize and BSize are logical-coordinate dimensions: // ISize is the size in the writing mode's inline direction (which equates to diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 94ffb11f662..f709494b02f 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -3178,7 +3178,7 @@ public: Init(aOther.GetFrame()); } - nsWeakFrame(nsIFrame* aFrame) : mPrev(nullptr), mFrame(nullptr) + MOZ_IMPLICIT nsWeakFrame(nsIFrame* aFrame) : mPrev(nullptr), mFrame(nullptr) { Init(aFrame); } diff --git a/layout/generic/nsLeafFrame.h b/layout/generic/nsLeafFrame.h index cdd29569222..e7459e86582 100644 --- a/layout/generic/nsLeafFrame.h +++ b/layout/generic/nsLeafFrame.h @@ -72,7 +72,7 @@ public: } protected: - nsLeafFrame(nsStyleContext* aContext) : nsFrame(aContext) {} + explicit nsLeafFrame(nsStyleContext* aContext) : nsFrame(aContext) {} virtual ~nsLeafFrame(); /** diff --git a/layout/generic/nsQueryFrame.h b/layout/generic/nsQueryFrame.h index 539921ee8df..63f501ba987 100644 --- a/layout/generic/nsQueryFrame.h +++ b/layout/generic/nsQueryFrame.h @@ -77,7 +77,13 @@ public: class do_QueryFrame { public: - do_QueryFrame(nsQueryFrame *s) : mRawPtr(s) { } + explicit do_QueryFrame(nsQueryFrame *s) : mRawPtr(s) { } + + // The return and argument types here are arbitrarily selected so no + // corresponding member function exists. + typedef void (do_QueryFrame::* MatchNullptr)(double, float); + // Implicit constructor for nullptr, trick borrowed from already_AddRefed. + MOZ_IMPLICIT do_QueryFrame(MatchNullptr aRawPtr) : mRawPtr(nullptr) {} template operator Dest*() { diff --git a/layout/generic/nsSplittableFrame.h b/layout/generic/nsSplittableFrame.h index 47ce69e1354..7b57bf020ec 100644 --- a/layout/generic/nsSplittableFrame.h +++ b/layout/generic/nsSplittableFrame.h @@ -74,7 +74,7 @@ public: static void RemoveFromFlow(nsIFrame* aFrame); protected: - nsSplittableFrame(nsStyleContext* aContext) : nsFrame(aContext) {} + explicit nsSplittableFrame(nsStyleContext* aContext) : nsFrame(aContext) {} /** * Determine the height consumed by our previous-in-flows. diff --git a/layout/generic/nsSubDocumentFrame.h b/layout/generic/nsSubDocumentFrame.h index f079b7ec43c..c4397f8bab8 100644 --- a/layout/generic/nsSubDocumentFrame.h +++ b/layout/generic/nsSubDocumentFrame.h @@ -21,7 +21,7 @@ public: NS_DECL_QUERYFRAME_TARGET(nsSubDocumentFrame) NS_DECL_FRAMEARENA_HELPERS - nsSubDocumentFrame(nsStyleContext* aContext); + explicit nsSubDocumentFrame(nsStyleContext* aContext); #ifdef DEBUG_FRAME_DUMP void List(FILE* out = stderr, const char* aPrefix = "", uint32_t aFlags = 0) const MOZ_OVERRIDE; diff --git a/layout/printing/nsPrintData.h b/layout/printing/nsPrintData.h index a2823130ca1..af121d3181d 100644 --- a/layout/printing/nsPrintData.h +++ b/layout/printing/nsPrintData.h @@ -41,7 +41,7 @@ public: typedef enum {eIsPrinting, eIsPrintPreview } ePrintDataType; - nsPrintData(ePrintDataType aType); + explicit nsPrintData(ePrintDataType aType); ~nsPrintData(); // non-virtual // Listener Helper Methods diff --git a/layout/style/CSSStyleSheet.h b/layout/style/CSSStyleSheet.h index f03c26be7dc..fac1ea76d53 100644 --- a/layout/style/CSSStyleSheet.h +++ b/layout/style/CSSStyleSheet.h @@ -115,7 +115,7 @@ class CSSStyleSheet MOZ_FINAL : public nsIStyleSheet, public nsWrapperCache { public: - CSSStyleSheet(CORSMode aCORSMode); + explicit CSSStyleSheet(CORSMode aCORSMode); NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(CSSStyleSheet, diff --git a/layout/style/CounterStyleManager.h b/layout/style/CounterStyleManager.h index af8f6ea93ef..a6530cf1ae8 100644 --- a/layout/style/CounterStyleManager.h +++ b/layout/style/CounterStyleManager.h @@ -104,7 +104,7 @@ class CounterStyleManager MOZ_FINAL private: ~CounterStyleManager(); public: - CounterStyleManager(nsPresContext* aPresContext); + explicit CounterStyleManager(nsPresContext* aPresContext); static void InitializeBuiltinCounterStyles(); diff --git a/layout/style/Loader.h b/layout/style/Loader.h index 4b691944012..19b781684f9 100644 --- a/layout/style/Loader.h +++ b/layout/style/Loader.h @@ -46,7 +46,7 @@ public: typedef URIPrincipalAndCORSModeHashKey* KeyType; typedef const URIPrincipalAndCORSModeHashKey* KeyTypePointer; - URIPrincipalAndCORSModeHashKey(const URIPrincipalAndCORSModeHashKey* aKey) + explicit URIPrincipalAndCORSModeHashKey(const URIPrincipalAndCORSModeHashKey* aKey) : nsURIHashKey(aKey->mKey), mPrincipal(aKey->mPrincipal), mCORSMode(aKey->mCORSMode) { @@ -130,7 +130,7 @@ enum StyleSheetState { class Loader MOZ_FINAL { public: Loader(); - Loader(nsIDocument*); + explicit Loader(nsIDocument*); private: // Private destructor, to discourage deletion outside of Release(): diff --git a/layout/style/nsCSSScanner.h b/layout/style/nsCSSScanner.h index 3d46686adf1..dc39f7d0619 100644 --- a/layout/style/nsCSSScanner.h +++ b/layout/style/nsCSSScanner.h @@ -363,7 +363,7 @@ struct MOZ_STACK_CLASS nsCSSGridTemplateAreaToken { // Scanner for the grid-template-areas micro-syntax class nsCSSGridTemplateAreaScanner { public: - nsCSSGridTemplateAreaScanner(const nsAString& aBuffer); + explicit nsCSSGridTemplateAreaScanner(const nsAString& aBuffer); // Get the next token. Return false on EOF. // aTokenResult is filled in with the data for the token. diff --git a/layout/style/nsCSSValue.h b/layout/style/nsCSSValue.h index d9accf94a5e..a9d7ddd912a 100644 --- a/layout/style/nsCSSValue.h +++ b/layout/style/nsCSSValue.h @@ -208,7 +208,7 @@ public: MOZ_COUNT_CTOR(FontFamilyListRefCnt); } - FontFamilyListRefCnt(FontFamilyType aGenericType) + explicit FontFamilyListRefCnt(FontFamilyType aGenericType) : FontFamilyList(aGenericType) { MOZ_COUNT_CTOR(FontFamilyListRefCnt); @@ -823,7 +823,7 @@ private: for (nsCSSValue *var = First() + 1, *var##_end = First() + mCount; \ var != var##_end; ++var) - Array(size_t aItemCount) + explicit Array(size_t aItemCount) : mRefCnt(0) , mCount(aItemCount) { @@ -904,7 +904,7 @@ struct nsCSSValueSharedList MOZ_FINAL { } // Takes ownership of aList. - nsCSSValueSharedList(nsCSSValueList* aList) + explicit nsCSSValueSharedList(nsCSSValueList* aList) : mHead(aList) { MOZ_COUNT_CTOR(nsCSSValueSharedList); @@ -1044,7 +1044,7 @@ struct nsCSSValuePair { { MOZ_COUNT_CTOR(nsCSSValuePair); } - nsCSSValuePair(nsCSSUnit aUnit) + explicit nsCSSValuePair(nsCSSUnit aUnit) : mXValue(aUnit), mYValue(aUnit) { MOZ_COUNT_CTOR(nsCSSValuePair); @@ -1128,7 +1128,7 @@ struct nsCSSValueTriplet { { MOZ_COUNT_CTOR(nsCSSValueTriplet); } - nsCSSValueTriplet(nsCSSUnit aUnit) + explicit nsCSSValueTriplet(nsCSSUnit aUnit) : mXValue(aUnit), mYValue(aUnit), mZValue(aUnit) { MOZ_COUNT_CTOR(nsCSSValueTriplet); diff --git a/layout/style/nsStyleCoord.h b/layout/style/nsStyleCoord.h index 20a57369f2e..c5ba2048f2b 100644 --- a/layout/style/nsStyleCoord.h +++ b/layout/style/nsStyleCoord.h @@ -82,7 +82,7 @@ public: Calc& operator=(const Calc&) MOZ_DELETE; }; - nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null); + explicit nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null); enum CoordConstructorType { CoordConstructor }; inline nsStyleCoord(nscoord aValue, CoordConstructorType); nsStyleCoord(int32_t aValue, nsStyleUnit aUnit); diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 32966f48d5d..65c504def84 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -65,7 +65,7 @@ class imgIContainer; struct nsStyleFont { nsStyleFont(const nsFont& aFont, nsPresContext *aPresContext); nsStyleFont(const nsStyleFont& aStyleFont); - nsStyleFont(nsPresContext *aPresContext); + explicit nsStyleFont(nsPresContext *aPresContext); private: void Init(nsPresContext *aPresContext); public: @@ -309,7 +309,7 @@ private: }; struct nsStyleColor { - nsStyleColor(nsPresContext* aPresContext); + explicit nsStyleColor(nsPresContext* aPresContext); nsStyleColor(const nsStyleColor& aOther); ~nsStyleColor(void) { MOZ_COUNT_DTOR(nsStyleColor); @@ -657,7 +657,7 @@ struct nsBorderColors { nscolor mColor; nsBorderColors() : mNext(nullptr), mColor(NS_RGB(0,0,0)) {} - nsBorderColors(const nscolor& aColor) : mNext(nullptr), mColor(aColor) {} + explicit nsBorderColors(const nscolor& aColor) : mNext(nullptr), mColor(aColor) {} ~nsBorderColors(); nsBorderColors* Clone() const { return Clone(true); } @@ -724,7 +724,7 @@ class nsCSSShadowArray MOZ_FINAL { (aArrayLen - 1) * sizeof(nsCSSShadowItem)); } - nsCSSShadowArray(uint32_t aArrayLen) : + explicit nsCSSShadowArray(uint32_t aArrayLen) : mLength(aArrayLen) { MOZ_COUNT_CTOR(nsCSSShadowArray); @@ -803,7 +803,7 @@ static bool IsVisibleBorderStyle(uint8_t aStyle) } struct nsStyleBorder { - nsStyleBorder(nsPresContext* aContext); + explicit nsStyleBorder(nsPresContext* aContext); nsStyleBorder(const nsStyleBorder& aBorder); ~nsStyleBorder(); @@ -1029,7 +1029,7 @@ private: struct nsStyleOutline { - nsStyleOutline(nsPresContext* aPresContext); + explicit nsStyleOutline(nsPresContext* aPresContext); nsStyleOutline(const nsStyleOutline& aOutline); ~nsStyleOutline(void) { MOZ_COUNT_DTOR(nsStyleOutline); @@ -1126,7 +1126,7 @@ protected: struct nsStyleList { - nsStyleList(nsPresContext* aPresContext); + explicit nsStyleList(nsPresContext* aPresContext); nsStyleList(const nsStyleList& aStyleList); ~nsStyleList(void); @@ -1724,7 +1724,7 @@ protected: }; struct nsStyleVisibility { - nsStyleVisibility(nsPresContext* aPresContext); + explicit nsStyleVisibility(nsPresContext* aPresContext); nsStyleVisibility(const nsStyleVisibility& aVisibility); ~nsStyleVisibility() { MOZ_COUNT_DTOR(nsStyleVisibility); @@ -2196,7 +2196,7 @@ struct nsStyleTable { }; struct nsStyleTableBorder { - nsStyleTableBorder(nsPresContext* aContext); + explicit nsStyleTableBorder(nsPresContext* aContext); nsStyleTableBorder(const nsStyleTableBorder& aOther); ~nsStyleTableBorder(void); @@ -2619,7 +2619,7 @@ struct nsStyleXUL { }; struct nsStyleColumn { - nsStyleColumn(nsPresContext* aPresContext); + explicit nsStyleColumn(nsPresContext* aPresContext); nsStyleColumn(const nsStyleColumn& aSource); ~nsStyleColumn(); diff --git a/view/nsView.h b/view/nsView.h index 6ff3711b077..00cb7f37c3a 100644 --- a/view/nsView.h +++ b/view/nsView.h @@ -381,8 +381,8 @@ public: nsIWidget* GetNearestWidget(nsPoint* aOffset, const int32_t aAPD) const; private: - nsView(nsViewManager* aViewManager = nullptr, - nsViewVisibility aVisibility = nsViewVisibility_kShow); + explicit nsView(nsViewManager* aViewManager = nullptr, + nsViewVisibility aVisibility = nsViewVisibility_kShow); bool ForcedRepaint() { return mForcedRepaint; } diff --git a/view/nsViewManager.h b/view/nsViewManager.h index 2bcc16af42b..ea5b5d637db 100644 --- a/view/nsViewManager.h +++ b/view/nsViewManager.h @@ -250,7 +250,7 @@ public: */ class MOZ_STACK_CLASS AutoDisableRefresh { public: - AutoDisableRefresh(nsViewManager* aVM) { + explicit AutoDisableRefresh(nsViewManager* aVM) { if (aVM) { mRootVM = aVM->IncrementDisableRefreshCount(); } From efa459041cbbc3bd2ee86140a541695b29d2ad53 Mon Sep 17 00:00:00 2001 From: Georgios Kontaxis Date: Thu, 7 Aug 2014 13:31:22 -0700 Subject: [PATCH 013/100] Bug 1044215: extended nsIWebProgressListener with tracking protection events (r=smaug) --- uriloader/base/nsIWebProgressListener.idl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/uriloader/base/nsIWebProgressListener.idl b/uriloader/base/nsIWebProgressListener.idl index efd41b30259..6bb6811cd2b 100644 --- a/uriloader/base/nsIWebProgressListener.idl +++ b/uriloader/base/nsIWebProgressListener.idl @@ -17,7 +17,7 @@ interface nsIURI; * nsIWebProgress instances. nsIWebProgress.idl describes the parent-child * relationship of nsIWebProgress instances. */ -[scriptable, uuid(a0cda7e4-c6ca-11e0-b6a5-001320257da5)] +[scriptable, uuid(a9df523b-efe2-421e-9d8e-3d7f807dda4c)] interface nsIWebProgressListener : nsISupports { /** @@ -199,6 +199,21 @@ interface nsIWebProgressListener : nsISupports const unsigned long STATE_BLOCKED_MIXED_DISPLAY_CONTENT = 0x00000100; const unsigned long STATE_LOADED_MIXED_DISPLAY_CONTENT = 0x00000200; + /** + * Tracking content flags + * + * May be set in addition to the State security Flags, to indicate that + * tracking content has been encountered. + * + * STATE_BLOCKED_TRACKING_CONTENT + * Tracking content has been blocked from loading. + * + * STATE_LOADED_TRACKING_CONTENT + * Tracking content has been loaded. + */ + const unsigned long STATE_BLOCKED_TRACKING_CONTENT = 0x00001000; + const unsigned long STATE_LOADED_TRACKING_CONTENT = 0x00002000; + /** * Security Strength Flags * From 4911859ba10c9453ed198c581663f07c85be7e30 Mon Sep 17 00:00:00 2001 From: Georgios Kontaxis Date: Thu, 7 Aug 2014 13:35:03 -0700 Subject: [PATCH 014/100] Bug 1048643: extended nsDocShell with flags to indicate tracking protection status (similar to mixed content blocked/loaded status) --- content/base/public/nsIDocument.h | 42 ++++++++++++++++++- content/base/src/nsImageLoadingContent.cpp | 5 +-- content/base/src/nsScriptLoader.cpp | 5 +-- docshell/base/nsDocShell.cpp | 23 ++++++++-- docshell/base/nsIDocShell.idl | 15 ++++++- .../boot/src/nsSecureBrowserUIImpl.cpp | 7 ++++ 6 files changed, 84 insertions(+), 13 deletions(-) diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 610b47f7910..c302b48d33a 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -133,8 +133,8 @@ typedef CallbackObjectHolder NodeFilterHolder; } // namespace mozilla #define NS_IDOCUMENT_IID \ -{ 0xa45ef8f0, 0x7c5b, 0x425d, \ - { 0xa5, 0xe7, 0x11, 0x41, 0x5c, 0x41, 0x0c, 0x7a } } +{ 0x613ea294, 0x0288, 0x48b4, \ + { 0x9e, 0x7b, 0x0f, 0xe9, 0x3f, 0x8c, 0xf8, 0x95 } } // Enum for requesting a particular type of document when creating a doc enum DocumentFlavor { @@ -532,6 +532,38 @@ public: mHasMixedDisplayContentBlocked = aHasMixedDisplayContentBlocked; } + /** + * Get tracking content blocked flag for this document. + */ + bool GetHasTrackingContentBlocked() + { + return mHasTrackingContentBlocked; + } + + /** + * Set the tracking content blocked flag for this document. + */ + void SetHasTrackingContentBlocked(bool aHasTrackingContentBlocked) + { + mHasTrackingContentBlocked = aHasTrackingContentBlocked; + } + + /** + * Get tracking content loaded flag for this document. + */ + bool GetHasTrackingContentLoaded() + { + return mHasTrackingContentLoaded; + } + + /** + * Set the tracking content loaded flag for this document. + */ + void SetHasTrackingContentLoaded(bool aHasTrackingContentLoaded) + { + mHasTrackingContentLoaded = aHasTrackingContentLoaded; + } + /** * Get the sandbox flags for this document. * @see nsSandboxFlags.h for the possible flags @@ -2531,6 +2563,12 @@ protected: // True if a document has blocked Mixed Display/Passive Content (see nsMixedContentBlocker.cpp) bool mHasMixedDisplayContentBlocked; + // True if a document has blocked Tracking Content + bool mHasTrackingContentBlocked; + + // True if a document has loaded Tracking Content + bool mHasTrackingContentLoaded; + // True if DisallowBFCaching has been called on this document. bool mBFCacheDisallowed; diff --git a/content/base/src/nsImageLoadingContent.cpp b/content/base/src/nsImageLoadingContent.cpp index 3cb833a2189..79525722ccd 100644 --- a/content/base/src/nsImageLoadingContent.cpp +++ b/content/base/src/nsImageLoadingContent.cpp @@ -169,9 +169,8 @@ nsImageLoadingContent::Notify(imgIRequest* aRequest, aRequest->GetImageErrorCode(&errorCode); /* Handle image not loading error because source was a tracking URL. - * (Safebrowinsg) We make a note of this image node by including it - * in a dedicated array of blocked tracking nodes under its parent - * document. + * We make a note of this image node by including it in a dedicated + * array of blocked tracking nodes under its parent document. */ if (errorCode == NS_ERROR_TRACKING_URI) { nsCOMPtr thisNode diff --git a/content/base/src/nsScriptLoader.cpp b/content/base/src/nsScriptLoader.cpp index 1f6c6e645c4..e97d236398e 100644 --- a/content/base/src/nsScriptLoader.cpp +++ b/content/base/src/nsScriptLoader.cpp @@ -1411,9 +1411,8 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader, if (NS_FAILED(rv)) { /* * Handle script not loading error because source was a tracking URL. - * (Safebrowinsg) We make a note of this script node by including it - * in a dedicated array of blocked tracking nodes under its parent - * document. + * We make a note of this script node by including it in a dedicated + * array of blocked tracking nodes under its parent document. */ if (rv == NS_ERROR_TRACKING_URI) { nsCOMPtr cont = do_QueryInterface(request->mElement); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index bca80b07ac2..3c5628b290a 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -2152,6 +2152,22 @@ nsDocShell::GetHasMixedDisplayContentBlocked(bool* aHasMixedDisplayContentBlocke return NS_OK; } +NS_IMETHODIMP +nsDocShell::GetHasTrackingContentBlocked(bool* aHasTrackingContentBlocked) +{ + nsCOMPtr doc(GetDocument()); + *aHasTrackingContentBlocked = doc && doc->GetHasTrackingContentBlocked(); + return NS_OK; +} + +NS_IMETHODIMP +nsDocShell::GetHasTrackingContentLoaded(bool* aHasTrackingContentLoaded) +{ + nsCOMPtr doc(GetDocument()); + *aHasTrackingContentLoaded = doc && doc->GetHasTrackingContentLoaded(); + return NS_OK; +} + NS_IMETHODIMP nsDocShell::GetAllowPlugins(bool * aAllowPlugins) { @@ -7123,10 +7139,9 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress, } // Handle iframe document not loading error because source was - // a tracking URL. (Safebrowsing) We make a note of this iframe - // node by including it in a dedicated array of blocked tracking - // nodes under its parent document. (document of parent window of - // blocked document) + // a tracking URL. We make a note of this iframe node by including + // it in a dedicated array of blocked tracking nodes under its parent + // document. (document of parent window of blocked document) if (isTopFrame == false && aStatus == NS_ERROR_TRACKING_URI) { // frameElement is our nsIContent to be annotated nsCOMPtr frameElement; diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index 18efa0c96c0..e1a203c57e4 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -54,7 +54,7 @@ interface nsITabParent; typedef unsigned long nsLoadFlags; -[scriptable, builtinclass, uuid(8ccc5a61-e053-4851-ab00-dadab0dffd7f)] +[scriptable, builtinclass, uuid(3646c915-df79-4500-8b57-c65ab9c3b39f)] interface nsIDocShell : nsIDocShellTreeItem { /** @@ -569,6 +569,19 @@ interface nsIDocShell : nsIDocShellTreeItem */ [infallible] readonly attribute boolean hasMixedDisplayContentBlocked; + /** + * This attribute determines whether a document has Tracking Content + * that has been blocked from loading. + */ + [infallible] readonly attribute boolean hasTrackingContentBlocked; + + /** + * This attribute determines whether Tracking Content is loaded on the + * document. When it is true, tracking content was not blocked and has + * loaded (or is about to load) on the page. + */ + [infallible] readonly attribute boolean hasTrackingContentLoaded; + /** * Disconnects this docshell's editor from its window, and stores the * editor data in the open document's session history entry. This diff --git a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp index c9034fbbd19..5c8001697ea 100644 --- a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp +++ b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp @@ -304,6 +304,13 @@ nsSecureBrowserUIImpl::MapInternalToExternalState(uint32_t* aState, lockIconStat if (docShell->GetHasMixedDisplayContentBlocked()) *aState |= nsIWebProgressListener::STATE_BLOCKED_MIXED_DISPLAY_CONTENT; + // Has Tracking Content been Blocked? + if (docShell->GetHasTrackingContentBlocked()) + *aState |= nsIWebProgressListener::STATE_BLOCKED_TRACKING_CONTENT; + + if (docShell->GetHasTrackingContentLoaded()) + *aState |= nsIWebProgressListener::STATE_LOADED_TRACKING_CONTENT; + return NS_OK; } From 4454b2c1e18d3f5809c1c6f3bee8d8b95fe78b52 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 7 Aug 2014 19:27:58 -0500 Subject: [PATCH 015/100] Bug 1035599: Merge the mozilla-central and comm-central objdir, r=gps This change merges mozilla-central and comm-central into having a single topobjdir file but retaining two topsrcdirs (and two build systems). This state is hopefully only the first part of a series of changes that eliminate the comm-central build system partial clone completely. --HG-- extra : rebase_source : 02aa2c4551df405d9783ac85cc41fe90b67bf057 extra : amend_source : d3cc677d59603648165bf65afa28413f2c40b2fd --- Makefile.in | 3 +- configure.in | 7 +- .../mozbuild/backend/recursivemake.py | 7 +- python/mozbuild/mozbuild/frontend/reader.py | 90 ++++++++++--------- .../mozbuild/test/frontend/test_sandbox.py | 3 +- 5 files changed, 61 insertions(+), 49 deletions(-) diff --git a/Makefile.in b/Makefile.in index 2edf0b60d33..63278051faa 100644 --- a/Makefile.in +++ b/Makefile.in @@ -328,7 +328,8 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3) toolkit/library/target: widget/gtk/mozgtk/gtk3/target endif ifdef MOZ_LDAP_XPCOM -toolkit/library/target: ../ldap/target +ldap/target: config/external/nss/target mozglue/build/target +toolkit/library/target: ldap/target endif ifndef MOZ_FOLD_LIBS ifndef MOZ_NATIVE_SQLITE diff --git a/configure.in b/configure.in index e8e0d7f6441..f743c11bdaf 100644 --- a/configure.in +++ b/configure.in @@ -2524,10 +2524,10 @@ if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then *) case $GCC_VERSION in 4.4*|4.6*) - VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden_dso_handle.h' + VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden_dso_handle.h' ;; *) - VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h' + VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden.h' ;; esac WRAP_SYSTEM_INCLUDES=1 @@ -9034,10 +9034,13 @@ unset CONFIG_FILES # Run all configure scripts specified by a subconfigure if test -n "$_subconfigure_subdir"; then + _save_srcdir="$srcdir" + srcdir="$srcdir/.." _save_ac_configure_args="$ac_configure_args" ac_configure_args="$_subconfigure_config_args" AC_OUTPUT_SUBDIRS("$_subconfigure_subdir") ac_configure_args="$_save_ac_configure_args" + srcdir="$_save_srcdir" fi # No need to run subconfigures when building with LIBXUL_SDK_DIR diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index 6c3d9c08305..4797868524b 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -89,7 +89,8 @@ class BackendMakeFile(object): actually change. We use FileAvoidWrite to accomplish this. """ - def __init__(self, srcdir, objdir, environment, topobjdir): + def __init__(self, srcdir, objdir, environment, topsrcdir, topobjdir): + self.topsrcdir = topsrcdir self.srcdir = srcdir self.objdir = objdir self.relobjdir = mozpath.relpath(objdir, topobjdir) @@ -329,7 +330,7 @@ class RecursiveMakeBackend(CommonBackend): if obj.objdir not in self._backend_files: self._backend_files[obj.objdir] = \ BackendMakeFile(obj.srcdir, obj.objdir, obj.config, - self.environment.topobjdir) + obj.topsrcdir, self.environment.topobjdir) backend_file = self._backend_files[obj.objdir] CommonBackend.consume_object(self, obj) @@ -696,7 +697,7 @@ class RecursiveMakeBackend(CommonBackend): obj = self.Substitution() obj.output_path = makefile obj.input_path = makefile_in - obj.topsrcdir = bf.environment.topsrcdir + obj.topsrcdir = backend_file.topsrcdir obj.topobjdir = bf.environment.topobjdir obj.config = bf.environment self._create_makefile(obj, stub=stub) diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py index cefed528d5e..35f6a7b821e 100644 --- a/python/mozbuild/mozbuild/frontend/reader.py +++ b/python/mozbuild/mozbuild/frontend/reader.py @@ -136,34 +136,25 @@ class MozbuildSandbox(Sandbox): topsrcdir = config.topsrcdir norm_topsrcdir = mozpath.normpath(topsrcdir) + self.external_source_dirs = [] + external_dirs = config.substs.get('EXTERNAL_SOURCE_DIR', '').split() + for external in external_dirs: + external = mozpath.normpath(external) + + if not os.path.isabs(external): + external = mozpath.join(config.topsrcdir, external) + + external = mozpath.normpath(external) + self.external_source_dirs.append(external) + + if not path.startswith(norm_topsrcdir): - external_dirs = config.substs.get('EXTERNAL_SOURCE_DIR', '').split() - for external in external_dirs: - external = mozpath.normpath(external) - - if not os.path.isabs(external): - external = mozpath.join(config.topsrcdir, external) - - external = mozpath.normpath(external) - + for external in self.external_source_dirs: if not path.startswith(external): continue topsrcdir = external - # This is really hacky and should be replaced with something - # more robust. We assume that if an external source directory - # is in play that the main build system is built in a - # subdirectory of its topobjdir. Therefore, the topobjdir of - # the external source directory is the parent of our topobjdir. - topobjdir = mozpath.dirname(topobjdir) - - # This is suboptimal because we load the config.status multiple - # times. We should consider caching it, possibly by moving this - # code up to the reader. - config = ConfigEnvironment.from_config_status( - mozpath.join(topobjdir, 'config.status')) - self.config = config break self.topsrcdir = topsrcdir @@ -196,8 +187,8 @@ class MozbuildSandbox(Sandbox): extra_vars = self.metadata.get('exports', dict()) self._globals.update(extra_vars) - def exec_file(self, path, filesystem_absolute=False): - """Override exec_file to normalize paths and restrict file loading. + def normalize_path(self, path, filesystem_absolute=False, srcdir=None): + """Normalizes paths. If the path is absolute, behavior is governed by filesystem_absolute. If filesystem_absolute is True, the path is interpreted as absolute on @@ -207,31 +198,45 @@ class MozbuildSandbox(Sandbox): If the path is not absolute, it will be treated as relative to the currently executing file. If there is no currently executing file, it will be treated as relative to topsrcdir. - - Paths will be rejected if they do not fall under topsrcdir. """ if os.path.isabs(path): - if not filesystem_absolute: - path = mozpath.normpath(mozpath.join(self.topsrcdir, - path[1:])) - + # If the path isn't in Unix-style, this is going to be problematic. + assert path[0] == '/' + if filesystem_absolute: + return path + for root in [self.topsrcdir] + self.external_source_dirs: + # mozpath.join would ignore the self.topsrcdir argument if we + # passed in the absolute path, so omit the leading / + p = mozpath.normpath(mozpath.join(root, path[1:])) + if os.path.exists(p): + return p + # mozpath.join would ignore the self.topsrcdir argument if we passed + # in the absolute path, so omit the leading / + return mozpath.normpath(mozpath.join(self.topsrcdir, path[1:])) + elif srcdir: + return mozpath.normpath(mozpath.join(srcdir, path)) + elif len(self._execution_stack): + return mozpath.normpath(mozpath.join( + mozpath.dirname(self._execution_stack[-1]), path)) else: - if len(self._execution_stack): - path = mozpath.normpath(mozpath.join( - mozpath.dirname(self._execution_stack[-1]), - path)) - else: - path = mozpath.normpath(mozpath.join( - self.topsrcdir, path)) + return mozpath.normpath(mozpath.join(self.topsrcdir, path)) + + def exec_file(self, path, filesystem_absolute=False): + """Override exec_file to normalize paths and restrict file loading. + + Paths will be rejected if they do not fall under topsrcdir or one of + the external roots. + """ # realpath() is needed for true security. But, this isn't for security # protection, so it is omitted. - normalized_path = mozpath.normpath(path) + normalized_path = self.normalize_path(path, + filesystem_absolute=filesystem_absolute) if not is_read_allowed(normalized_path, self.config): raise SandboxLoadError(list(self._execution_stack), sys.exc_info()[2], illegal_path=path) - Sandbox.exec_file(self, path) + Sandbox.exec_file(self, normalized_path) def _add_java_jar(self, name): """Add a Java JAR build target.""" @@ -874,16 +879,19 @@ class BuildReader(object): 'times in %s' % (d, tier), sandbox) recurse_info[d] = {'tier': tier, 'parent': sandbox['RELATIVEDIR'], + 'check_external': True, 'var': 'DIRS'} for relpath, child_metadata in recurse_info.items(): - child_path = mozpath.join(curdir, relpath, 'moz.build') + if 'check_external' in child_metadata: + relpath = '/' + relpath + child_path = sandbox.normalize_path(mozpath.join(relpath, + 'moz.build'), srcdir=curdir) # Ensure we don't break out of the topsrcdir. We don't do realpath # because it isn't necessary. If there are symlinks in the srcdir, # that's not our problem. We're not a hosted application: we don't # need to worry about security too much. - child_path = mozpath.normpath(child_path) if not is_read_allowed(child_path, sandbox.config): raise SandboxValidationError( 'Attempting to process file outside of allowed paths: %s' % diff --git a/python/mozbuild/mozbuild/test/frontend/test_sandbox.py b/python/mozbuild/mozbuild/test/frontend/test_sandbox.py index e482976d677..4aa712231c7 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_sandbox.py +++ b/python/mozbuild/mozbuild/test/frontend/test_sandbox.py @@ -227,8 +227,7 @@ add_tier_dir('t1', 'bat') with self.assertRaises(SandboxLoadError) as se: sandbox.exec_file('relative.build') - expected = mozpath.join(test_data_path, 'moz.build') - self.assertEqual(se.exception.illegal_path, expected) + self.assertEqual(se.exception.illegal_path, '../moz.build') def test_include_error_stack(self): # Ensure the path stack is reported properly in exceptions. From b65420961807a388bcc66ff4b0680d50ead5d556 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 7 Aug 2014 19:29:00 -0500 Subject: [PATCH 016/100] Bug 1035599: Fix branding directory location for comm-central, r=glandium --- configure.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.in b/configure.in index f743c11bdaf..6cf00af6b83 100644 --- a/configure.in +++ b/configure.in @@ -4579,6 +4579,8 @@ fi if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh" +elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then + . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh" fi AC_SUBST(MOZ_BRANDING_DIRECTORY) From 6464562a03dbf8abe48242b3ecd368094b9d5d09 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Thu, 7 Aug 2014 18:16:25 -0700 Subject: [PATCH 017/100] Backed out changeset c62468b61fed (bug 1041695) for bustage on a CLOSED TREE --- gfx/layers/ipc/ShadowLayers.cpp | 33 +-------------------------------- gfx/layers/ipc/ShadowLayers.h | 2 -- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index 0a3a57e5a77..dc4bfab2acb 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -473,42 +473,11 @@ ShadowLayerForwarder::RemoveTextureFromCompositableAsync(AsyncTransactionTracker aAsyncTransactionTracker); } -bool -ShadowLayerForwarder::InWorkerThread() -{ - return GetMessageLoop()->id() == MessageLoop::current()->id(); -} - -static void RemoveTextureWorker(TextureClient* aTexture, ReentrantMonitor* aBarrier, bool* aDone) -{ - aTexture->ForceRemove(); - - ReentrantMonitorAutoEnter autoMon(*aBarrier); - *aDone = true; - aBarrier->NotifyAll(); -} - void ShadowLayerForwarder::RemoveTexture(TextureClient* aTexture) { MOZ_ASSERT(aTexture); - if (InWorkerThread()) { - aTexture->ForceRemove(); - return; - } - - ReentrantMonitor barrier("ShadowLayerForwarder::RemoveTexture Lock"); - ReentrantMonitorAutoEnter autoMon(barrier); - bool done = false; - - GetMessageLoop()->PostTask( - FROM_HERE, - NewRunnableFunction(&RemoveTextureWorker, aTexture, &barrier, &done)); - - // Wait until the TextureClient has been ForceRemoved on the worker thread - while (!done) { - barrier.Wait(); - } + aTexture->ForceRemove(); } bool diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index 24e01d5e835..452c169852f 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -393,8 +393,6 @@ protected: void CheckSurfaceDescriptor(const SurfaceDescriptor* aDescriptor) const {} #endif - bool InWorkerThread(); - RefPtr mShadowManager; private: From 95005f1ba6570afb8247aa4c5ef5cc57c673745b Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 7 Aug 2014 20:16:13 -0500 Subject: [PATCH 018/100] Bustage fix for bug 1035599, r+a=bustage-fix for CLOSED TREE --HG-- extra : rebase_source : 9fc6f0cc80749f869abf3124b6fecd490b023d1c extra : amend_source : a53044cb583fb213903092848faccc087bab6289 --- python/mozbuild/mozbuild/frontend/reader.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py index 35f6a7b821e..790bc25f501 100644 --- a/python/mozbuild/mozbuild/frontend/reader.py +++ b/python/mozbuild/mozbuild/frontend/reader.py @@ -200,8 +200,6 @@ class MozbuildSandbox(Sandbox): will be treated as relative to topsrcdir. """ if os.path.isabs(path): - # If the path isn't in Unix-style, this is going to be problematic. - assert path[0] == '/' if filesystem_absolute: return path for root in [self.topsrcdir] + self.external_source_dirs: From 5e38fdb0ffc8569c0d264bdd17043d2f905234f0 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 7 Aug 2014 21:29:39 -0400 Subject: [PATCH 019/100] Bug 1043390 - Don't use getSourceRepo on local builds; r=glandium --- b2g/app/Makefile.in | 5 ----- build/Makefile.in | 2 ++ toolkit/components/telemetry/Makefile.in | 2 ++ toolkit/content/Makefile.in | 2 ++ toolkit/mozapps/installer/package-name.mk | 2 ++ toolkit/mozapps/installer/packager.mk | 6 ++++-- toolkit/xre/Makefile.in | 10 ++++++---- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/b2g/app/Makefile.in b/b2g/app/Makefile.in index 71596aaa3c6..c0bf9ffd89a 100644 --- a/b2g/app/Makefile.in +++ b/b2g/app/Makefile.in @@ -24,11 +24,6 @@ include $(topsrcdir)/config/rules.mk APP_ICON = b2g -source_repo ?= $(call getSourceRepo,$(srcdir)/..) -ifneq (,$(filter http%,$(source_repo))) - DEFINES += -DMOZ_SOURCE_REPO='$(source_repo)' -endif - ifeq ($(OS_ARCH),WINNT) REDIT_PATH = $(LIBXUL_DIST)/bin endif diff --git a/build/Makefile.in b/build/Makefile.in index 417d9f1fe8e..40c3514d2d2 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -33,10 +33,12 @@ ifdef MOZ_SOURCE_STAMP DEFINES += -DMOZ_SOURCE_STAMP='$(MOZ_SOURCE_STAMP)' endif +ifdef MOZILLA_OFFICIAL source_repo ?= $(call getSourceRepo,$(topsrcdir)/$(MOZ_BUILD_APP)/..) ifneq (,$(source_repo)) DEFINES += -DMOZ_SOURCE_REPO='$(source_repo)' endif +endif endif diff --git a/toolkit/components/telemetry/Makefile.in b/toolkit/components/telemetry/Makefile.in index bebc099c6c4..b58fa9a9222 100644 --- a/toolkit/components/telemetry/Makefile.in +++ b/toolkit/components/telemetry/Makefile.in @@ -8,10 +8,12 @@ include $(topsrcdir)/config/makefiles/rcs.mk DEFINES += -DMOZ_APP_VERSION='"$(MOZ_APP_VERSION)"' +ifdef MOZILLA_OFFICIAL MOZ_HISTOGRAMS_VERSION ?= $(call getSourceRepo)/rev/$(firstword $(shell hg -R $(topsrcdir) parent --template='{node|short}\n' 2>/dev/null)) ifdef MOZ_HISTOGRAMS_VERSION DEFINES += -DHISTOGRAMS_FILE_VERSION='$(MOZ_HISTOGRAMS_VERSION)' endif +endif INSTALL_TARGETS += histoenums histoenums_FILES := TelemetryHistogramEnums.h diff --git a/toolkit/content/Makefile.in b/toolkit/content/Makefile.in index ba43f063831..8779e2b7e41 100644 --- a/toolkit/content/Makefile.in +++ b/toolkit/content/Makefile.in @@ -16,12 +16,14 @@ ifdef MOZ_SOURCE_STAMP DEFINES += -DSOURCE_CHANGESET='$(MOZ_SOURCE_STAMP)' endif +ifdef MOZILLA_OFFICIAL source_repo ?= $(call getSourceRepo) ifneq (,$(filter http%,$(source_repo))) DEFINES += -DSOURCE_REPO='$(source_repo)' else ifneq (,$(strip $(source_repo))) DEFINES += -DSOURCE_GIT_COMMIT='$(source_repo)' endif +endif ifndef BUILD_HOSTNAME BUILD_HOSTNAME = $(shell hostname -s || hostname) diff --git a/toolkit/mozapps/installer/package-name.mk b/toolkit/mozapps/installer/package-name.mk index 4cb98b45575..1040c217ef9 100644 --- a/toolkit/mozapps/installer/package-name.mk +++ b/toolkit/mozapps/installer/package-name.mk @@ -145,7 +145,9 @@ MOZ_SOURCE_STAMP = $(firstword $(shell hg -R $(MOZILLA_DIR) parent --template="{ # bug: 746277 - preserve existing functionality. # MOZILLA_DIR="": cd $(SPACE); hg # succeeds if ~/.hg exists ########################################################################### +ifdef MOZILLA_OFFICIAL MOZ_SOURCE_REPO = $(call getSourceRepo,$(MOZILLA_DIR)$(NULL) $(NULL)) +endif MOZ_SOURCESTAMP_FILE = $(DIST)/$(PKG_PATH)/$(MOZ_INFO_BASENAME).txt MOZ_BUILDINFO_FILE = $(DIST)/$(PKG_PATH)/$(MOZ_INFO_BASENAME).json diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk index 8af082a63cd..3bf80e8284b 100644 --- a/toolkit/mozapps/installer/packager.mk +++ b/toolkit/mozapps/installer/packager.mk @@ -217,7 +217,7 @@ RPM_CMD = \ --define 'moz_numeric_app_version $(MOZ_NUMERIC_APP_VERSION)' \ --define 'moz_rpm_release $(MOZ_RPM_RELEASE)' \ --define 'buildid $(BUILDID)' \ - --define 'moz_source_repo $(MOZ_SOURCE_REPO)' \ + $(if $(MOZ_SOURCE_REPO),--define 'moz_source_repo $(MOZ_SOURCE_REPO)') \ --define 'moz_source_stamp $(MOZ_SOURCE_STAMP)' \ --define 'moz_branding_directory $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)' \ --define '_topdir $(RPMBUILD_TOPDIR)' \ @@ -757,14 +757,16 @@ GARBAGE += make-package make-sourcestamp-file:: $(NSINSTALL) -D $(DIST)/$(PKG_PATH) @echo '$(BUILDID)' > $(MOZ_SOURCESTAMP_FILE) +ifdef MOZ_SOURCE_REPO @echo '$(MOZ_SOURCE_REPO)/rev/$(MOZ_SOURCE_STAMP)' >> $(MOZ_SOURCESTAMP_FILE) +endif .PHONY: make-buildinfo-file make-buildinfo-file: $(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/informulate.py \ $(MOZ_BUILDINFO_FILE) \ BUILDID=$(BUILDID) \ - MOZ_SOURCE_REPO=$(MOZ_SOURCE_REPO) \ + $(addprefix MOZ_SOURCE_REPO=,MOZ_SOURCE_REPO=$(MOZ_SOURCE_REPO)) \ MOZ_SOURCE_STAMP=$(MOZ_SOURCE_STAMP) \ MOZ_PKG_PLATFORM=$(MOZ_PKG_PLATFORM) diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in index 92a9da41f77..b9dfb3a312a 100644 --- a/toolkit/xre/Makefile.in +++ b/toolkit/xre/Makefile.in @@ -24,11 +24,13 @@ ifdef MOZ_SOURCE_STAMP INIARGS = --sourcestamp=$(MOZ_SOURCE_STAMP) - source_repo := $(call getSourceRepo) + ifdef MOZILLA_OFFICIAL + source_repo := $(call getSourceRepo) - # extra sanity check for old versions of hg, no showconfig support - ifneq (,$(filter http%,$(source_repo))) - INIARGS += --sourcerepo=$(source_repo) + # extra sanity check for old versions of hg, no showconfig support + ifneq (,$(filter http%,$(source_repo))) + INIARGS += --sourcerepo=$(source_repo) + endif endif endif # MOZ_SOURCE_STAMP From a2f2e240cf3ced802f5b2206ba955c1a805f1220 Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Thu, 7 Aug 2014 18:13:12 +1200 Subject: [PATCH 020/100] b=995075 update speex resampler to speexdsp 769dc295 r=padenot --HG-- extra : rebase_source : 786ee924d4d41745bfad84fbf9457c82db4158fb --- media/libspeex_resampler/README_MOZILLA | 2 +- media/libspeex_resampler/hugemem.patch | 16 +-- media/libspeex_resampler/src/resample.c | 139 +++++++++++++++++------- 3 files changed, 107 insertions(+), 50 deletions(-) diff --git a/media/libspeex_resampler/README_MOZILLA b/media/libspeex_resampler/README_MOZILLA index c1422e252c3..8acc0fcf91a 100644 --- a/media/libspeex_resampler/README_MOZILLA +++ b/media/libspeex_resampler/README_MOZILLA @@ -1,5 +1,5 @@ This source is from the Speex DSP library -(http://git.xiph.org/?p=speexdsp.git), from commit 305e54ea. +(http://git.xiph.org/?p=speexdsp.git), from commit 769dc295. It consists in the audio resampling code (resampler.c) and its header files dependancies, imported into the tree using the update.sh script. diff --git a/media/libspeex_resampler/hugemem.patch b/media/libspeex_resampler/hugemem.patch index 9657c237024..ad9321cb316 100644 --- a/media/libspeex_resampler/hugemem.patch +++ b/media/libspeex_resampler/hugemem.patch @@ -20,7 +20,7 @@ diff --git a/media/libspeex_resampler/src/resample.c b/media/libspeex_resampler/ #include "speex_resampler.h" #include "arch.h" #else /* OUTSIDE_SPEEX */ -@@ -613,18 +615,18 @@ static void update_filter(SpeexResampler +@@ -632,18 +634,18 @@ static int update_filter(SpeexResamplerS if (st->oversample < 1) st->oversample = 1; } else { @@ -30,14 +30,14 @@ diff --git a/media/libspeex_resampler/src/resample.c b/media/libspeex_resampler/ /* Choose the resampling type that requires the least amount of memory */ -#ifdef RESAMPLE_FULL_SINC_TABLE -- if (1) +- use_direct = 1; +#ifdef RESAMPLE_HUGEMEM -+ if (st->den_rate <= 16*(st->oversample+8)) ++ use_direct = st->den_rate <= 16*(st->oversample+8); #else - if (st->filt_len*st->den_rate <= st->filt_len*st->oversample+8) + use_direct = st->filt_len*st->den_rate <= st->filt_len*st->oversample+8; #endif + if (use_direct) { - spx_uint32_t i; - if (st->sinc_table_length < st->filt_len*st->den_rate) - { - st->sinc_table = (spx_word16_t *)speex_realloc(st->sinc_table,st->filt_len*st->den_rate*sizeof(spx_word16_t)); + min_sinc_table_length = st->filt_len*st->den_rate; + } else { + min_sinc_table_length = st->filt_len*st->oversample+8; diff --git a/media/libspeex_resampler/src/resample.c b/media/libspeex_resampler/src/resample.c index 4268ec6b1cc..053a5b25ecc 100644 --- a/media/libspeex_resampler/src/resample.c +++ b/media/libspeex_resampler/src/resample.c @@ -140,7 +140,7 @@ struct SpeexResamplerState_ { int out_stride; } ; -static double kaiser12_table[68] = { +static const double kaiser12_table[68] = { 0.99859849, 1.00000000, 0.99859849, 0.99440475, 0.98745105, 0.97779076, 0.96549770, 0.95066529, 0.93340547, 0.91384741, 0.89213598, 0.86843014, 0.84290116, 0.81573067, 0.78710866, 0.75723148, 0.72629970, 0.69451601, @@ -154,7 +154,7 @@ static double kaiser12_table[68] = { 0.00105297, 0.00069463, 0.00043489, 0.00025272, 0.00013031, 0.0000527734, 0.00001000, 0.00000000}; /* -static double kaiser12_table[36] = { +static const double kaiser12_table[36] = { 0.99440475, 1.00000000, 0.99440475, 0.97779076, 0.95066529, 0.91384741, 0.86843014, 0.81573067, 0.75723148, 0.69451601, 0.62920216, 0.56287762, 0.49704014, 0.43304576, 0.37206735, 0.31506490, 0.26276832, 0.21567274, @@ -162,7 +162,7 @@ static double kaiser12_table[36] = { 0.03111947, 0.02127838, 0.01402878, 0.00886058, 0.00531256, 0.00298291, 0.00153438, 0.00069463, 0.00025272, 0.0000527734, 0.00000500, 0.00000000}; */ -static double kaiser10_table[36] = { +static const double kaiser10_table[36] = { 0.99537781, 1.00000000, 0.99537781, 0.98162644, 0.95908712, 0.92831446, 0.89005583, 0.84522401, 0.79486424, 0.74011713, 0.68217934, 0.62226347, 0.56155915, 0.50119680, 0.44221549, 0.38553619, 0.33194107, 0.28205962, @@ -170,7 +170,7 @@ static double kaiser10_table[36] = { 0.05731132, 0.04193980, 0.02979584, 0.02044510, 0.01345224, 0.00839739, 0.00488951, 0.00257636, 0.00115101, 0.00035515, 0.00000000, 0.00000000}; -static double kaiser8_table[36] = { +static const double kaiser8_table[36] = { 0.99635258, 1.00000000, 0.99635258, 0.98548012, 0.96759014, 0.94302200, 0.91223751, 0.87580811, 0.83439927, 0.78875245, 0.73966538, 0.68797126, 0.63451750, 0.58014482, 0.52566725, 0.47185369, 0.41941150, 0.36897272, @@ -178,7 +178,7 @@ static double kaiser8_table[36] = { 0.10562887, 0.08273982, 0.06335451, 0.04724088, 0.03412321, 0.02369490, 0.01563093, 0.00959968, 0.00527363, 0.00233883, 0.00050000, 0.00000000}; -static double kaiser6_table[36] = { +static const double kaiser6_table[36] = { 0.99733006, 1.00000000, 0.99733006, 0.98935595, 0.97618418, 0.95799003, 0.93501423, 0.90755855, 0.87598009, 0.84068475, 0.80211977, 0.76076565, 0.71712752, 0.67172623, 0.62508937, 0.57774224, 0.53019925, 0.48295561, @@ -187,19 +187,19 @@ static double kaiser6_table[36] = { 0.05031820, 0.03607231, 0.02432151, 0.01487334, 0.00752000, 0.00000000}; struct FuncDef { - double *table; + const double *table; int oversample; }; -static struct FuncDef _KAISER12 = {kaiser12_table, 64}; +static const struct FuncDef _KAISER12 = {kaiser12_table, 64}; #define KAISER12 (&_KAISER12) /*static struct FuncDef _KAISER12 = {kaiser12_table, 32}; #define KAISER12 (&_KAISER12)*/ -static struct FuncDef _KAISER10 = {kaiser10_table, 32}; +static const struct FuncDef _KAISER10 = {kaiser10_table, 32}; #define KAISER10 (&_KAISER10) -static struct FuncDef _KAISER8 = {kaiser8_table, 32}; +static const struct FuncDef _KAISER8 = {kaiser8_table, 32}; #define KAISER8 (&_KAISER8) -static struct FuncDef _KAISER6 = {kaiser6_table, 32}; +static const struct FuncDef _KAISER6 = {kaiser6_table, 32}; #define KAISER6 (&_KAISER6) struct QualityMapping { @@ -207,7 +207,7 @@ struct QualityMapping { int oversample; float downsample_bandwidth; float upsample_bandwidth; - struct FuncDef *window_func; + const struct FuncDef *window_func; }; @@ -234,7 +234,7 @@ static const struct QualityMapping quality_map[11] = { {256, 32, 0.975f, 0.975f, KAISER12}, /* Q10 */ /* 96.6% cutoff (~100 dB stop) 10 */ }; /*8,24,40,56,80,104,128,160,200,256,320*/ -static double compute_func(float x, struct FuncDef *func) +static double compute_func(float x, const struct FuncDef *func) { float y, frac; double interp[4]; @@ -269,7 +269,7 @@ int main(int argc, char **argv) #ifdef FIXED_POINT /* The slow way of computing a sinc for the table. Should improve that some day */ -static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_func) +static spx_word16_t sinc(float cutoff, float x, int N, const struct FuncDef *window_func) { /*fprintf (stderr, "%f ", x);*/ float xx = x * cutoff; @@ -282,7 +282,7 @@ static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_fu } #else /* The slow way of computing a sinc for the table. Should improve that some day */ -static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_func) +static spx_word16_t sinc(float cutoff, float x, int N, const struct FuncDef *window_func) { /*fprintf (stderr, "%f ", x);*/ float xx = x * cutoff; @@ -571,12 +571,47 @@ static int resampler_basic_interpolate_double(SpeexResamplerState *st, spx_uint3 } #endif -static void update_filter(SpeexResamplerState *st) +/* This resampler is used to produce zero output in situations where memory + for the filter could not be allocated. The expected numbers of input and + output samples are still processed so that callers failing to check error + codes are not surprised, possibly getting into infinite loops. */ +static int resampler_basic_zero(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len) +{ + int out_sample = 0; + int last_sample = st->last_sample[channel_index]; + spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index]; + const int out_stride = st->out_stride; + const int int_advance = st->int_advance; + const int frac_advance = st->frac_advance; + const spx_uint32_t den_rate = st->den_rate; + + while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len)) + { + out[out_stride * out_sample++] = 0; + last_sample += int_advance; + samp_frac_num += frac_advance; + if (samp_frac_num >= den_rate) + { + samp_frac_num -= den_rate; + last_sample++; + } + } + + st->last_sample[channel_index] = last_sample; + st->samp_frac_num[channel_index] = samp_frac_num; + return out_sample; +} + +static int update_filter(SpeexResamplerState *st) { spx_uint32_t old_length = st->filt_len; spx_uint32_t old_alloc_size = st->mem_alloc_size; + int use_direct; + spx_uint32_t min_sinc_table_length; spx_uint32_t min_alloc_size; + st->int_advance = st->num_rate/st->den_rate; + st->frac_advance = st->num_rate%st->den_rate; st->oversample = quality_map[st->quality].oversample; st->filt_len = quality_map[st->quality].base_length; @@ -605,17 +640,28 @@ static void update_filter(SpeexResamplerState *st) /* Choose the resampling type that requires the least amount of memory */ #ifdef RESAMPLE_HUGEMEM - if (st->den_rate <= 16*(st->oversample+8)) + use_direct = st->den_rate <= 16*(st->oversample+8); #else - if (st->filt_len*st->den_rate <= st->filt_len*st->oversample+8) + use_direct = st->filt_len*st->den_rate <= st->filt_len*st->oversample+8; #endif + if (use_direct) + { + min_sinc_table_length = st->filt_len*st->den_rate; + } else { + min_sinc_table_length = st->filt_len*st->oversample+8; + } + if (st->sinc_table_length < min_sinc_table_length) + { + spx_word16_t *sinc_table = (spx_word16_t *)speex_realloc(st->sinc_table,min_sinc_table_length*sizeof(spx_word16_t)); + if (!sinc_table) + goto fail; + + st->sinc_table = sinc_table; + st->sinc_table_length = min_sinc_table_length; + } + if (use_direct) { spx_uint32_t i; - if (st->sinc_table_length < st->filt_len*st->den_rate) - { - st->sinc_table = (spx_word16_t *)speex_realloc(st->sinc_table,st->filt_len*st->den_rate*sizeof(spx_word16_t)); - st->sinc_table_length = st->filt_len*st->den_rate; - } for (i=0;iden_rate;i++) { spx_int32_t j; @@ -635,11 +681,6 @@ static void update_filter(SpeexResamplerState *st) /*fprintf (stderr, "resampler uses direct sinc table and normalised cutoff %f\n", cutoff);*/ } else { spx_int32_t i; - if (st->sinc_table_length < st->filt_len*st->oversample+8) - { - st->sinc_table = (spx_word16_t *)speex_realloc(st->sinc_table,(st->filt_len*st->oversample+8)*sizeof(spx_word16_t)); - st->sinc_table_length = st->filt_len*st->oversample+8; - } for (i=-4;i<(spx_int32_t)(st->oversample*st->filt_len+4);i++) st->sinc_table[i+4] = sinc(st->cutoff,(i/(float)st->oversample - st->filt_len/2), st->filt_len, quality_map[st->quality].window_func); #ifdef FIXED_POINT @@ -652,8 +693,6 @@ static void update_filter(SpeexResamplerState *st) #endif /*fprintf (stderr, "resampler uses interpolated sinc table and normalised cutoff %f\n", cutoff);*/ } - st->int_advance = st->num_rate/st->den_rate; - st->frac_advance = st->num_rate%st->den_rate; /* Here's the place where we update the filter memory to take into account @@ -662,7 +701,11 @@ static void update_filter(SpeexResamplerState *st) min_alloc_size = st->filt_len-1 + st->buffer_size; if (min_alloc_size > st->mem_alloc_size) { - st->mem = (spx_word16_t*)speex_realloc(st->mem, st->nb_channels*min_alloc_size * sizeof(spx_word16_t)); + spx_word16_t *mem = (spx_word16_t*)speex_realloc(st->mem, st->nb_channels*min_alloc_size * sizeof(spx_word16_t)); + if (!mem) + goto fail; + + st->mem = mem; st->mem_alloc_size = min_alloc_size; } if (!st->started) @@ -727,7 +770,15 @@ static void update_filter(SpeexResamplerState *st) st->magic_samples[i] += old_magic; } } + return RESAMPLER_ERR_SUCCESS; +fail: + st->resampler_ptr = resampler_basic_zero; + /* st->mem may still contain consumed input samples for the filter. + Restore filt_len so that filt_len - 1 still points to the position after + the last of these samples. */ + st->filt_len = old_length; + return RESAMPLER_ERR_ALLOC_FAILED; } EXPORT SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err) @@ -739,6 +790,8 @@ EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, { spx_uint32_t i; SpeexResamplerState *st; + int filter_err; + if (quality > 10 || quality < 0) { if (err) @@ -780,12 +833,16 @@ EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, speex_resampler_set_quality(st, quality); speex_resampler_set_rate_frac(st, ratio_num, ratio_den, in_rate, out_rate); - - update_filter(st); - - st->initialised = 1; + filter_err = update_filter(st); + if (filter_err == RESAMPLER_ERR_SUCCESS) + { + st->initialised = 1; + } else { + speex_resampler_destroy(st); + st = NULL; + } if (err) - *err = RESAMPLER_ERR_SUCCESS; + *err = filter_err; return st; } @@ -884,7 +941,7 @@ EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t c } *in_len -= ilen; *out_len -= olen; - return RESAMPLER_ERR_SUCCESS; + return st->resampler_ptr == resampler_basic_zero ? RESAMPLER_ERR_ALLOC_FAILED : RESAMPLER_ERR_SUCCESS; } #ifdef FIXED_POINT @@ -958,7 +1015,7 @@ EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t cha *in_len -= ilen; *out_len -= olen; - return RESAMPLER_ERR_SUCCESS; + return st->resampler_ptr == resampler_basic_zero ? RESAMPLER_ERR_ALLOC_FAILED : RESAMPLER_ERR_SUCCESS; } EXPORT int speex_resampler_process_interleaved_float(SpeexResamplerState *st, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len) @@ -981,7 +1038,7 @@ EXPORT int speex_resampler_process_interleaved_float(SpeexResamplerState *st, co } st->in_stride = istride_save; st->out_stride = ostride_save; - return RESAMPLER_ERR_SUCCESS; + return st->resampler_ptr == resampler_basic_zero ? RESAMPLER_ERR_ALLOC_FAILED : RESAMPLER_ERR_SUCCESS; } EXPORT int speex_resampler_process_interleaved_int(SpeexResamplerState *st, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len) @@ -1004,7 +1061,7 @@ EXPORT int speex_resampler_process_interleaved_int(SpeexResamplerState *st, cons } st->in_stride = istride_save; st->out_stride = ostride_save; - return RESAMPLER_ERR_SUCCESS; + return st->resampler_ptr == resampler_basic_zero ? RESAMPLER_ERR_ALLOC_FAILED : RESAMPLER_ERR_SUCCESS; } EXPORT int speex_resampler_set_rate(SpeexResamplerState *st, spx_uint32_t in_rate, spx_uint32_t out_rate) @@ -1053,7 +1110,7 @@ EXPORT int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t r } if (st->initialised) - update_filter(st); + return update_filter(st); return RESAMPLER_ERR_SUCCESS; } @@ -1071,7 +1128,7 @@ EXPORT int speex_resampler_set_quality(SpeexResamplerState *st, int quality) return RESAMPLER_ERR_SUCCESS; st->quality = quality; if (st->initialised) - update_filter(st); + return update_filter(st); return RESAMPLER_ERR_SUCCESS; } From 908fbe7326be9a2596768b3dfcefec2d642c0fa4 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Thu, 7 Aug 2014 19:03:24 -0700 Subject: [PATCH 021/100] Bug 1045955 - Make snapshots pick RGBA or RGBX. - r=kamidphish --- dom/canvas/WebGLContext.cpp | 10 +++++++--- gfx/gl/GLBlitHelper.cpp | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp index f6bf6f009e7..a4a61b369ad 100644 --- a/dom/canvas/WebGLContext.cpp +++ b/dom/canvas/WebGLContext.cpp @@ -1477,9 +1477,13 @@ WebGLContext::GetSurfaceSnapshot(bool* aPremultAlpha) if (!gl) return nullptr; - RefPtr surf = Factory::CreateDataSourceSurfaceWithStride(IntSize(mWidth, mHeight), - SurfaceFormat::B8G8R8A8, - mWidth * 4); + bool hasAlpha = mOptions.alpha; + SurfaceFormat surfFormat = hasAlpha ? SurfaceFormat::B8G8R8A8 + : SurfaceFormat::B8G8R8X8; + RefPtr surf; + surf = Factory::CreateDataSourceSurfaceWithStride(IntSize(mWidth, mHeight), + surfFormat, + mWidth * 4); if (!surf) { return nullptr; } diff --git a/gfx/gl/GLBlitHelper.cpp b/gfx/gl/GLBlitHelper.cpp index 5ae43098b8c..474ad5f7ae8 100644 --- a/gfx/gl/GLBlitHelper.cpp +++ b/gfx/gl/GLBlitHelper.cpp @@ -812,6 +812,7 @@ GLBlitHelper::BlitTextureToFramebuffer(GLuint srcTex, GLuint destFB, } ScopedGLDrawState autoStates(mGL); + mGL->BindDrawFB(destFB); // Does destructive things to (only!) what we just saved above. bool good = UseTexQuadProgram(type, srcSize); From 12c1a698951b02e9e08986daa9aa960438c90329 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Thu, 7 Aug 2014 19:03:25 -0700 Subject: [PATCH 022/100] Bug 1045955 - Allow blitting 'internal' fb0. - r=kamidphish --- gfx/gl/GLBlitHelper.cpp | 50 +++++++++++++++++++++++++++++------------ gfx/gl/GLBlitHelper.h | 12 ++++++---- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/gfx/gl/GLBlitHelper.cpp b/gfx/gl/GLBlitHelper.cpp index 474ad5f7ae8..eca7e096139 100644 --- a/gfx/gl/GLBlitHelper.cpp +++ b/gfx/gl/GLBlitHelper.cpp @@ -546,7 +546,8 @@ GLBlitHelper::DeleteTexBlitProgram() void GLBlitHelper::BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB, const gfx::IntSize& srcSize, - const gfx::IntSize& destSize) + const gfx::IntSize& destSize, + bool internalFBs) { MOZ_ASSERT(!srcFB || mGL->fIsFramebuffer(srcFB)); MOZ_ASSERT(!destFB || mGL->fIsFramebuffer(destFB)); @@ -556,8 +557,13 @@ GLBlitHelper::BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB, ScopedBindFramebuffer boundFB(mGL); ScopedGLState scissor(mGL, LOCAL_GL_SCISSOR_TEST, false); - mGL->BindReadFB(srcFB); - mGL->BindDrawFB(destFB); + if (internalFBs) { + mGL->Screen()->BindReadFB_Internal(srcFB); + mGL->Screen()->BindDrawFB_Internal(destFB); + } else { + mGL->BindReadFB(srcFB); + mGL->BindDrawFB(destFB); + } mGL->fBlitFramebuffer(0, 0, srcSize.width, srcSize.height, 0, 0, destSize.width, destSize.height, @@ -569,22 +575,24 @@ void GLBlitHelper::BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB, const gfx::IntSize& srcSize, const gfx::IntSize& destSize, - const GLFormats& srcFormats) + const GLFormats& srcFormats, + bool internalFBs) { MOZ_ASSERT(!srcFB || mGL->fIsFramebuffer(srcFB)); MOZ_ASSERT(!destFB || mGL->fIsFramebuffer(destFB)); if (mGL->IsSupported(GLFeature::framebuffer_blit)) { BlitFramebufferToFramebuffer(srcFB, destFB, - srcSize, destSize); + srcSize, destSize, + internalFBs); return; } GLuint tex = CreateTextureForOffscreen(mGL, srcFormats, srcSize); MOZ_ASSERT(tex); - BlitFramebufferToTexture(srcFB, tex, srcSize, srcSize); - BlitTextureToFramebuffer(tex, destFB, srcSize, destSize); + BlitFramebufferToTexture(srcFB, tex, srcSize, srcSize, internalFBs); + BlitTextureToFramebuffer(tex, destFB, srcSize, destSize, internalFBs); mGL->fDeleteTextures(1, &tex); } @@ -782,7 +790,8 @@ void GLBlitHelper::BlitTextureToFramebuffer(GLuint srcTex, GLuint destFB, const gfx::IntSize& srcSize, const gfx::IntSize& destSize, - GLenum srcTarget) + GLenum srcTarget, + bool internalFBs) { MOZ_ASSERT(mGL->fIsTexture(srcTex)); MOZ_ASSERT(!destFB || mGL->fIsFramebuffer(destFB)); @@ -792,7 +801,8 @@ GLBlitHelper::BlitTextureToFramebuffer(GLuint srcTex, GLuint destFB, MOZ_ASSERT(srcWrapper.IsComplete()); BlitFramebufferToFramebuffer(srcWrapper.FB(), destFB, - srcSize, destSize); + srcSize, destSize, + internalFBs); return; } @@ -812,7 +822,11 @@ GLBlitHelper::BlitTextureToFramebuffer(GLuint srcTex, GLuint destFB, } ScopedGLDrawState autoStates(mGL); - mGL->BindDrawFB(destFB); + if (internalFBs) { + mGL->Screen()->BindDrawFB_Internal(destFB); + } else { + mGL->BindDrawFB(destFB); + } // Does destructive things to (only!) what we just saved above. bool good = UseTexQuadProgram(type, srcSize); @@ -829,7 +843,8 @@ void GLBlitHelper::BlitFramebufferToTexture(GLuint srcFB, GLuint destTex, const gfx::IntSize& srcSize, const gfx::IntSize& destSize, - GLenum destTarget) + GLenum destTarget, + bool internalFBs) { MOZ_ASSERT(!srcFB || mGL->fIsFramebuffer(srcFB)); MOZ_ASSERT(mGL->fIsTexture(destTex)); @@ -838,14 +853,21 @@ GLBlitHelper::BlitFramebufferToTexture(GLuint srcFB, GLuint destTex, ScopedFramebufferForTexture destWrapper(mGL, destTex, destTarget); BlitFramebufferToFramebuffer(srcFB, destWrapper.FB(), - srcSize, destSize); + srcSize, destSize, + internalFBs); return; } ScopedBindTexture autoTex(mGL, destTex, destTarget); - ScopedBindFramebuffer boundFB(mGL, srcFB); - ScopedGLState scissor(mGL, LOCAL_GL_SCISSOR_TEST, false); + ScopedBindFramebuffer boundFB(mGL); + if (internalFBs) { + mGL->Screen()->BindReadFB_Internal(srcFB); + } else { + mGL->BindReadFB(srcFB); + } + + ScopedGLState scissor(mGL, LOCAL_GL_SCISSOR_TEST, false); mGL->fCopyTexSubImage2D(destTarget, 0, 0, 0, 0, 0, diff --git a/gfx/gl/GLBlitHelper.h b/gfx/gl/GLBlitHelper.h index 1f9c6be2586..a3330797c8f 100644 --- a/gfx/gl/GLBlitHelper.h +++ b/gfx/gl/GLBlitHelper.h @@ -153,19 +153,23 @@ public: // the first BlitFramebufferToFramebuffer. void BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB, const gfx::IntSize& srcSize, - const gfx::IntSize& destSize); + const gfx::IntSize& destSize, + bool internalFBs = false); void BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB, const gfx::IntSize& srcSize, const gfx::IntSize& destSize, - const GLFormats& srcFormats); + const GLFormats& srcFormats, + bool internalFBs = false); void BlitTextureToFramebuffer(GLuint srcTex, GLuint destFB, const gfx::IntSize& srcSize, const gfx::IntSize& destSize, - GLenum srcTarget = LOCAL_GL_TEXTURE_2D); + GLenum srcTarget = LOCAL_GL_TEXTURE_2D, + bool internalFBs = false); void BlitFramebufferToTexture(GLuint srcFB, GLuint destTex, const gfx::IntSize& srcSize, const gfx::IntSize& destSize, - GLenum destTarget = LOCAL_GL_TEXTURE_2D); + GLenum destTarget = LOCAL_GL_TEXTURE_2D, + bool internalFBs = false); void BlitTextureToTexture(GLuint srcTex, GLuint destTex, const gfx::IntSize& srcSize, const gfx::IntSize& destSize, From b5386297254af892bec5afd2893a16960d970d1a Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Thu, 7 Aug 2014 19:03:25 -0700 Subject: [PATCH 023/100] Bug 1045955 - Tighten requirements for framebuffer_blit, and use GL_FRAMEBUFFER when unavailable. - r=kamidphish --- gfx/gl/GLBlitHelper.cpp | 8 +++--- gfx/gl/GLScreenBuffer.cpp | 53 +++++++++++++++++++++++---------------- gfx/gl/GLScreenBuffer.h | 1 + 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/gfx/gl/GLBlitHelper.cpp b/gfx/gl/GLBlitHelper.cpp index eca7e096139..8b6e59a0313 100644 --- a/gfx/gl/GLBlitHelper.cpp +++ b/gfx/gl/GLBlitHelper.cpp @@ -823,9 +823,9 @@ GLBlitHelper::BlitTextureToFramebuffer(GLuint srcTex, GLuint destFB, ScopedGLDrawState autoStates(mGL); if (internalFBs) { - mGL->Screen()->BindDrawFB_Internal(destFB); + mGL->Screen()->BindFB_Internal(destFB); } else { - mGL->BindDrawFB(destFB); + mGL->BindFB(destFB); } // Does destructive things to (only!) what we just saved above. @@ -862,9 +862,9 @@ GLBlitHelper::BlitFramebufferToTexture(GLuint srcFB, GLuint destTex, ScopedBindFramebuffer boundFB(mGL); if (internalFBs) { - mGL->Screen()->BindReadFB_Internal(srcFB); + mGL->Screen()->BindFB_Internal(srcFB); } else { - mGL->BindReadFB(srcFB); + mGL->BindFB(srcFB); } ScopedGLState scissor(mGL, LOCAL_GL_SCISSOR_TEST, false); diff --git a/gfx/gl/GLScreenBuffer.cpp b/gfx/gl/GLScreenBuffer.cpp index fb83cb0aaab..74fc127979a 100755 --- a/gfx/gl/GLScreenBuffer.cpp +++ b/gfx/gl/GLScreenBuffer.cpp @@ -147,17 +147,13 @@ GLScreenBuffer::BindFB(GLuint fb) void GLScreenBuffer::BindDrawFB(GLuint fb) { - if (!mGL->IsSupported(GLFeature::framebuffer_blit)) { - NS_WARNING("DRAW_FRAMEBUFFER requested, but unsupported."); + MOZ_ASSERT(mGL->IsSupported(GLFeature::framebuffer_blit)); - mGL->raw_fBindFramebuffer(LOCAL_GL_DRAW_FRAMEBUFFER_EXT, fb); - } else { - GLuint drawFB = DrawFB(); - mUserDrawFB = fb; - mInternalDrawFB = (fb == 0) ? drawFB : fb; + GLuint drawFB = DrawFB(); + mUserDrawFB = fb; + mInternalDrawFB = (fb == 0) ? drawFB : fb; - mGL->raw_fBindFramebuffer(LOCAL_GL_DRAW_FRAMEBUFFER_EXT, mInternalDrawFB); - } + mGL->raw_fBindFramebuffer(LOCAL_GL_DRAW_FRAMEBUFFER_EXT, mInternalDrawFB); #ifdef DEBUG mInInternalMode_DrawFB = false; @@ -167,28 +163,39 @@ GLScreenBuffer::BindDrawFB(GLuint fb) void GLScreenBuffer::BindReadFB(GLuint fb) { - if (!mGL->IsSupported(GLFeature::framebuffer_blit)) { - NS_WARNING("READ_FRAMEBUFFER requested, but unsupported."); + MOZ_ASSERT(mGL->IsSupported(GLFeature::framebuffer_blit)); - mGL->raw_fBindFramebuffer(LOCAL_GL_READ_FRAMEBUFFER_EXT, fb); - } else { - GLuint readFB = ReadFB(); - mUserReadFB = fb; - mInternalReadFB = (fb == 0) ? readFB : fb; + GLuint readFB = ReadFB(); + mUserReadFB = fb; + mInternalReadFB = (fb == 0) ? readFB : fb; - mGL->raw_fBindFramebuffer(LOCAL_GL_READ_FRAMEBUFFER_EXT, mInternalReadFB); - } + mGL->raw_fBindFramebuffer(LOCAL_GL_READ_FRAMEBUFFER_EXT, mInternalReadFB); #ifdef DEBUG mInInternalMode_ReadFB = false; #endif } +void +GLScreenBuffer::BindFB_Internal(GLuint fb) +{ + mInternalDrawFB = mUserDrawFB = fb; + mInternalReadFB = mUserReadFB = fb; + mGL->raw_fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mInternalDrawFB); + +#ifdef DEBUG + mInInternalMode_DrawFB = true; + mInInternalMode_ReadFB = true; +#endif +} + void GLScreenBuffer::BindDrawFB_Internal(GLuint fb) { - mInternalDrawFB = mUserDrawFB = fb; - mGL->raw_fBindFramebuffer(LOCAL_GL_DRAW_FRAMEBUFFER_EXT, mInternalDrawFB); + MOZ_ASSERT(mGL->IsSupported(GLFeature::framebuffer_blit)); + + mInternalDrawFB = mUserDrawFB = fb; + mGL->raw_fBindFramebuffer(LOCAL_GL_DRAW_FRAMEBUFFER_EXT, mInternalDrawFB); #ifdef DEBUG mInInternalMode_DrawFB = true; @@ -198,8 +205,10 @@ GLScreenBuffer::BindDrawFB_Internal(GLuint fb) void GLScreenBuffer::BindReadFB_Internal(GLuint fb) { - mInternalReadFB = mUserReadFB = fb; - mGL->raw_fBindFramebuffer(LOCAL_GL_READ_FRAMEBUFFER_EXT, mInternalReadFB); + MOZ_ASSERT(mGL->IsSupported(GLFeature::framebuffer_blit)); + + mInternalReadFB = mUserReadFB = fb; + mGL->raw_fBindFramebuffer(LOCAL_GL_READ_FRAMEBUFFER_EXT, mInternalReadFB); #ifdef DEBUG mInInternalMode_ReadFB = true; diff --git a/gfx/gl/GLScreenBuffer.h b/gfx/gl/GLScreenBuffer.h index 60965970fbd..5f39512a58a 100644 --- a/gfx/gl/GLScreenBuffer.h +++ b/gfx/gl/GLScreenBuffer.h @@ -269,6 +269,7 @@ public: // Here `fb` is the actual framebuffer you want bound. Binding 0 will // bind the (generally useless) default framebuffer. + void BindFB_Internal(GLuint fb); void BindDrawFB_Internal(GLuint fb); void BindReadFB_Internal(GLuint fb); }; From 5e66cf642c7ebd2eb0c57dee366463b029a1ef9a Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Thu, 7 Aug 2014 19:03:25 -0700 Subject: [PATCH 024/100] Bug 1045955 - Style fix. - r=kamidphish --- gfx/gl/SharedSurface.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/gfx/gl/SharedSurface.cpp b/gfx/gl/SharedSurface.cpp index 443c1884706..27743607fce 100644 --- a/gfx/gl/SharedSurface.cpp +++ b/gfx/gl/SharedSurface.cpp @@ -59,13 +59,20 @@ SharedSurface::ProdCopy(SharedSurface* src, SharedSurface* dest, GLuint destTex = dest->ProdTexture(); GLenum destTarget = dest->ProdTextureTarget(); - gl->BlitHelper()->BlitFramebufferToTexture(0, destTex, src->mSize, dest->mSize, destTarget); + gl->BlitHelper()->BlitFramebufferToTexture(0, destTex, + src->mSize, + dest->mSize, + destTarget, + true); } else if (dest->mAttachType == AttachmentType::GLRenderbuffer) { GLuint destRB = dest->ProdRenderbuffer(); ScopedFramebufferForRenderbuffer destWrapper(gl, destRB); - gl->BlitHelper()->BlitFramebufferToFramebuffer(0, destWrapper.FB(), - src->mSize, dest->mSize); + gl->BlitHelper()->BlitFramebufferToFramebuffer(0, + destWrapper.FB(), + src->mSize, + dest->mSize, + true); } else { MOZ_CRASH("Unhandled dest->mAttachType."); } @@ -97,13 +104,20 @@ SharedSurface::ProdCopy(SharedSurface* src, SharedSurface* dest, GLuint srcTex = src->ProdTexture(); GLenum srcTarget = src->ProdTextureTarget(); - gl->BlitHelper()->BlitTextureToFramebuffer(srcTex, 0, src->mSize, dest->mSize, srcTarget); + gl->BlitHelper()->BlitTextureToFramebuffer(srcTex, 0, + src->mSize, + dest->mSize, + srcTarget, + true); } else if (src->mAttachType == AttachmentType::GLRenderbuffer) { GLuint srcRB = src->ProdRenderbuffer(); ScopedFramebufferForRenderbuffer srcWrapper(gl, srcRB); - gl->BlitHelper()->BlitFramebufferToFramebuffer(srcWrapper.FB(), 0, - src->mSize, dest->mSize); + gl->BlitHelper()->BlitFramebufferToFramebuffer(srcWrapper.FB(), + 0, + src->mSize, + dest->mSize, + true); } else { MOZ_CRASH("Unhandled src->mAttachType."); } From 8d03f0b88450f90e51cd487eecb09aa463430578 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Thu, 7 Aug 2014 19:08:10 -0700 Subject: [PATCH 025/100] Backed out changeset 2422647220de (bug 1038899) for mochitest-2 bustage on a CLOSED TREE --- dom/canvas/WebGLContextGL.cpp | 3 -- dom/canvas/WebGLProgram.cpp | 63 +++++++++++++++++------------------ dom/canvas/WebGLProgram.h | 16 --------- 3 files changed, 30 insertions(+), 52 deletions(-) diff --git a/dom/canvas/WebGLContextGL.cpp b/dom/canvas/WebGLContextGL.cpp index a5b328ec4a9..759d62c1294 100644 --- a/dom/canvas/WebGLContextGL.cpp +++ b/dom/canvas/WebGLContextGL.cpp @@ -1967,11 +1967,8 @@ WebGLContext::LinkProgram(WebGLProgram *program) if (program == mCurrentProgram) gl->fUseProgram(progname); } - - program->InitializeUniformAndAttributeMaps(); } else { program->SetLinkStatus(false); - program->ClearUniformAndAttributeMaps(); if (ShouldGenerateWarnings()) { diff --git a/dom/canvas/WebGLProgram.cpp b/dom/canvas/WebGLProgram.cpp index ac9b2be0415..975f9fd4194 100644 --- a/dom/canvas/WebGLProgram.cpp +++ b/dom/canvas/WebGLProgram.cpp @@ -14,10 +14,10 @@ using namespace mozilla; /** Takes an ASCII string like "foo[i]", turns it into "foo" and returns "[i]" in bracketPart - * + * * \param string input/output: the string to split, becomes the string without the bracket part * \param bracketPart output: gets the bracket part. - * + * * Notice that if there are multiple brackets like "foo[i].bar[j]", only the last bracket is split. */ static bool SplitLastSquareBracket(nsACString& string, nsCString& bracketPart) @@ -133,38 +133,22 @@ WebGLProgram::UpperBoundNumSamplerUniforms() { return numSamplerUniforms; } -void -WebGLProgram::InitializeUniformAndAttributeMaps() -{ - if (mIdentifierMap) { - mIdentifierMap->Clear(); - } else { - mIdentifierMap = new CStringMap; - } - - if (mIdentifierReverseMap) { - mIdentifierReverseMap->Clear(); - } else { - mIdentifierReverseMap = new CStringMap; - } - - for (size_t i = 0; i < mAttachedShaders.Length(); i++) { - for (size_t j = 0; j < mAttachedShaders[i]->mAttributes.Length(); j++) { - const WebGLMappedIdentifier& attrib = mAttachedShaders[i]->mAttributes[j]; - mIdentifierMap->Put(attrib.original, attrib.mapped); - mIdentifierReverseMap->Put(attrib.mapped, attrib.original); - } - for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) { - const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j]; - mIdentifierMap->Put(uniform.original, uniform.mapped); - mIdentifierReverseMap->Put(uniform.mapped, uniform.original); - } - } -} - void WebGLProgram::MapIdentifier(const nsACString& name, nsCString *mappedName) { - MOZ_ASSERT(mIdentifierMap); + if (!mIdentifierMap) { + // if the identifier map doesn't exist yet, build it now + mIdentifierMap = new CStringMap; + for (size_t i = 0; i < mAttachedShaders.Length(); i++) { + for (size_t j = 0; j < mAttachedShaders[i]->mAttributes.Length(); j++) { + const WebGLMappedIdentifier& attrib = mAttachedShaders[i]->mAttributes[j]; + mIdentifierMap->Put(attrib.original, attrib.mapped); + } + for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) { + const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j]; + mIdentifierMap->Put(uniform.original, uniform.mapped); + } + } + } nsCString mutableName(name); nsCString bracketPart; @@ -196,7 +180,20 @@ WebGLProgram::MapIdentifier(const nsACString& name, nsCString *mappedName) { void WebGLProgram::ReverseMapIdentifier(const nsACString& name, nsCString *reverseMappedName) { - MOZ_ASSERT(mIdentifierReverseMap); + if (!mIdentifierReverseMap) { + // if the identifier reverse map doesn't exist yet, build it now + mIdentifierReverseMap = new CStringMap; + for (size_t i = 0; i < mAttachedShaders.Length(); i++) { + for (size_t j = 0; j < mAttachedShaders[i]->mAttributes.Length(); j++) { + const WebGLMappedIdentifier& attrib = mAttachedShaders[i]->mAttributes[j]; + mIdentifierReverseMap->Put(attrib.mapped, attrib.original); + } + for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) { + const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j]; + mIdentifierReverseMap->Put(uniform.mapped, uniform.original); + } + } + } nsCString mutableName(name); nsCString bracketPart; diff --git a/dom/canvas/WebGLProgram.h b/dom/canvas/WebGLProgram.h index 103807a0b28..ddd2cb0f00d 100644 --- a/dom/canvas/WebGLProgram.h +++ b/dom/canvas/WebGLProgram.h @@ -81,22 +81,6 @@ public: /* Getters for cached program info */ bool IsAttribInUse(unsigned i) const { return mAttribsInUse[i]; } - /* Initialize the maps used by MapIdentifier and ReverseMapIdentifier. This should - * be called after each time the program has been successfully linked. - */ - void InitializeUniformAndAttributeMaps(); - - /* Clear the maps used by MapIdentifier and ReverseMapIdentifier. This should be - * called each time the program has failed to link. - */ - void ClearUniformAndAttributeMaps() { - if (mIdentifierMap) - mIdentifierMap->Clear(); - - if (mIdentifierReverseMap) - mIdentifierReverseMap->Clear(); - } - /* Maps identifier |name| to the mapped identifier |*mappedName| * Both are ASCII strings. */ From c3d78aa0619d6cbb50f3fa88b04eaac3ebd99f40 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Thu, 7 Aug 2014 22:21:05 -0400 Subject: [PATCH 026/100] Bug 1044245: don't track Windows IPC stack frames on non-gui threads r=bsmedberg --- ipc/glue/WindowsMessageLoop.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/ipc/glue/WindowsMessageLoop.cpp b/ipc/glue/WindowsMessageLoop.cpp index aad27382200..3de93a765b1 100644 --- a/ipc/glue/WindowsMessageLoop.cpp +++ b/ipc/glue/WindowsMessageLoop.cpp @@ -642,6 +642,11 @@ MessageChannel::SyncStackFrame::SyncStackFrame(MessageChannel* channel, bool int , mPrev(mChannel->mTopFrame) , mStaticPrev(sStaticTopFrame) { + // Only track stack frames when we are on the gui thread. + if (GetCurrentThreadId() != gUIThreadId) { + return; + } + mChannel->mTopFrame = this; sStaticTopFrame = this; @@ -654,6 +659,10 @@ MessageChannel::SyncStackFrame::SyncStackFrame(MessageChannel* channel, bool int MessageChannel::SyncStackFrame::~SyncStackFrame() { + if (GetCurrentThreadId() != gUIThreadId) { + return; + } + NS_ASSERTION(this == mChannel->mTopFrame, "Mismatched interrupt stack frames"); NS_ASSERTION(this == sStaticTopFrame, @@ -692,6 +701,8 @@ MessageChannel::NotifyGeckoEventDispatch() void MessageChannel::ProcessNativeEventsInInterruptCall() { + NS_ASSERTION(GetCurrentThreadId() == gUIThreadId, + "Shouldn't be on a non-main thread in here!"); if (!mTopFrame) { NS_ERROR("Spin logic error: no Interrupt frame"); return; @@ -775,6 +786,10 @@ MessageChannel::WaitForSyncNotify() MOZ_ASSERT(gUIThreadId, "InitUIThread was not called!"); + // We jump through a lot of unique hoops in dealing with Windows message + // trapping to prevent re-entrancy when we are blocked waiting on a sync + // reply or new rpc in-call. However none of this overhead is needed when + // we aren't on the main (gui) thread. if (GetCurrentThreadId() != gUIThreadId) { PRIntervalTime timeout = (kNoTimeout == mTimeoutMs) ? PR_INTERVAL_NO_TIMEOUT : @@ -795,9 +810,13 @@ MessageChannel::WaitForSyncNotify() // If the timeout didn't expire, we know we received an event. The // converse is not true. - return WaitResponse(timeout == PR_INTERVAL_NO_TIMEOUT ? false : IsTimeoutExpired(waitStart, timeout)); + return WaitResponse(timeout == PR_INTERVAL_NO_TIMEOUT ? + false : IsTimeoutExpired(waitStart, timeout)); } + NS_ASSERTION(GetCurrentThreadId() == gUIThreadId, + "Shouldn't be on a non-main thread in here!"); + NS_ASSERTION(mTopFrame && !mTopFrame->mInterrupt, "Top frame is not a sync frame!"); @@ -919,10 +938,16 @@ MessageChannel::WaitForInterruptNotify() MOZ_ASSERT(gUIThreadId, "InitUIThread was not called!"); + // Re-use sync notification wait code when we aren't on the + // gui thread, which bypasses the gui thread hoops we jump + // through in dealing with Windows messaging. if (GetCurrentThreadId() != gUIThreadId) { return WaitForSyncNotify(); } + NS_ASSERTION(GetCurrentThreadId() == gUIThreadId, + "Shouldn't be on a non-main thread in here!"); + if (!InterruptStackDepth()) { // There is currently no way to recover from this condition. NS_RUNTIMEABORT("StackDepth() is 0 in call to MessageChannel::WaitForNotify!"); From 59b45ae708d2aca39e25d57b289ebb5153a056bd Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 7 Aug 2014 22:36:23 -0400 Subject: [PATCH 027/100] Bug 1050263: Remove incorrect name reference from email subject when emailing a loop url r=dhenein,arcadio --- browser/components/loop/content/js/panel.js | 2 +- browser/components/loop/content/js/panel.jsx | 2 +- browser/components/loop/test/desktop-local/panel_test.js | 2 +- browser/locales/en-US/chrome/browser/loop/loop.properties | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/browser/components/loop/content/js/panel.js b/browser/components/loop/content/js/panel.js index ef194baad3d..a08a1798ce6 100644 --- a/browser/components/loop/content/js/panel.js +++ b/browser/components/loop/content/js/panel.js @@ -211,7 +211,7 @@ loop.panel = (function(_, mozL10n) { _generateMailTo: function() { return encodeURI([ - "mailto:?subject=" + __("share_email_subject") + "&", + "mailto:?subject=" + __("share_email_subject2") + "&", "body=" + __("share_email_body", {callUrl: this.state.callUrl}) ].join("")); }, diff --git a/browser/components/loop/content/js/panel.jsx b/browser/components/loop/content/js/panel.jsx index c074ff167fe..37e919c060b 100644 --- a/browser/components/loop/content/js/panel.jsx +++ b/browser/components/loop/content/js/panel.jsx @@ -211,7 +211,7 @@ loop.panel = (function(_, mozL10n) { _generateMailTo: function() { return encodeURI([ - "mailto:?subject=" + __("share_email_subject") + "&", + "mailto:?subject=" + __("share_email_subject2") + "&", "body=" + __("share_email_body", {callUrl: this.state.callUrl}) ].join("")); }, diff --git a/browser/components/loop/test/desktop-local/panel_test.js b/browser/components/loop/test/desktop-local/panel_test.js index 80a0b690f88..1714aa26064 100644 --- a/browser/components/loop/test/desktop-local/panel_test.js +++ b/browser/components/loop/test/desktop-local/panel_test.js @@ -253,7 +253,7 @@ describe("loop.panel", function() { getStrings: function(key) { var text; - if (key === "share_email_subject") + if (key === "share_email_subject2") text = "email-subject"; else if (key === "share_email_body") text = "{{callUrl}}"; diff --git a/browser/locales/en-US/chrome/browser/loop/loop.properties b/browser/locales/en-US/chrome/browser/loop/loop.properties index 0b9e6e9d4ba..1176c22fcc7 100644 --- a/browser/locales/en-US/chrome/browser/loop/loop.properties +++ b/browser/locales/en-US/chrome/browser/loop/loop.properties @@ -57,9 +57,9 @@ feedback_back_button=Back ## translate the part between {{..}} feedback_window_will_close_in=This window will close in {{countdown}} seconds +share_email_subject2=Invitation to chat ## LOCALIZATION NOTE (share_email_body): In this item, don't translate the ## part between {{..}} and let the \r\n\r\n part -share_email_subject=Loop invitation to chat share_email_body=Please click that link to call me back:\r\n\r\n{{callUrl}} share_button=Email copy_url_button=Copy From b7a84dcba652e977bc4d08b7f1ad0750137d2a6b Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Fri, 8 Aug 2014 14:43:54 +1200 Subject: [PATCH 028/100] Bug 1047107 - Make CDMProxy Close() its GMPDecryptorProxy on Shutdown. r=ehsan --- content/media/eme/CDMProxy.cpp | 18 ++++++++++++++---- content/media/eme/CDMProxy.h | 3 +++ content/media/eme/MediaKeys.cpp | 12 ++++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/content/media/eme/CDMProxy.cpp b/content/media/eme/CDMProxy.cpp index 125cb41dd6a..106eccab4e1 100644 --- a/content/media/eme/CDMProxy.cpp +++ b/content/media/eme/CDMProxy.cpp @@ -302,6 +302,19 @@ CDMProxy::Shutdown() { MOZ_ASSERT(NS_IsMainThread()); mKeys.Clear(); + // Note: This may end up being the last owning reference to the CDMProxy. + nsRefPtr task(NS_NewRunnableMethod(this, &CDMProxy::gmp_Shutdown)); + mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL); +} + +void +CDMProxy::gmp_Shutdown() +{ + MOZ_ASSERT(IsOnGMPThread()); + if (mCDM) { + mCDM->Close(); + mCDM = nullptr; + } } void @@ -485,10 +498,7 @@ CDMProxy::gmp_Terminated() { MOZ_ASSERT(IsOnGMPThread()); EME_LOG("CDM terminated"); - if (mCDM) { - mCDM->Close(); - mCDM = nullptr; - } + gmp_Shutdown(); } } // namespace mozilla diff --git a/content/media/eme/CDMProxy.h b/content/media/eme/CDMProxy.h index 30c05baf6db..d03a0bb6825 100644 --- a/content/media/eme/CDMProxy.h +++ b/content/media/eme/CDMProxy.h @@ -167,6 +167,9 @@ private: // GMP thread only. void gmp_Init(uint32_t aPromiseId); + // GMP thread only. + void gmp_Shutdown(); + // Main thread only. void OnCDMCreated(uint32_t aPromiseId); diff --git a/content/media/eme/MediaKeys.cpp b/content/media/eme/MediaKeys.cpp index 9c55959f0fe..0c1c4a0d3e4 100644 --- a/content/media/eme/MediaKeys.cpp +++ b/content/media/eme/MediaKeys.cpp @@ -44,12 +44,24 @@ MediaKeys::MediaKeys(nsPIDOMWindow* aParent, const nsAString& aKeySystem) SetIsDOMBinding(); } +static PLDHashOperator +RejectPromises(const uint32_t& aKey, + nsRefPtr& aPromise, + void* aClosure) +{ + aPromise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR); + return PL_DHASH_NEXT; +} + MediaKeys::~MediaKeys() { if (mProxy) { mProxy->Shutdown(); mProxy = nullptr; } + + mPromises.Enumerate(&RejectPromises, nullptr); + mPromises.Clear(); } nsPIDOMWindow* From bd67a2de13cd62b45bcd22c88081f035bd6db60b Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Fri, 8 Aug 2014 14:44:01 +1200 Subject: [PATCH 029/100] Bug 1050199 - Support the GMP returning arbitrary audio sample rates and number of channels. r=jesup --- content/media/fmp4/eme/EMEAACDecoder.cpp | 24 +++++++++---- content/media/fmp4/eme/EMEAACDecoder.h | 4 ++- content/media/fmp4/eme/EMEH264Decoder.cpp | 2 ++ content/media/gmp/GMPAudioDecoderChild.cpp | 2 ++ content/media/gmp/GMPAudioDecoderParent.cpp | 5 ++- content/media/gmp/GMPAudioDecoderProxy.h | 7 +++- content/media/gmp/GMPAudioHost.cpp | 35 ++++++++++++++++++- content/media/gmp/GMPAudioHost.h | 11 +++++- content/media/gmp/GMPTypes.ipdlh | 4 +++ content/media/gmp/gmp-api/gmp-audio-samples.h | 17 +++++++++ 10 files changed, 99 insertions(+), 12 deletions(-) diff --git a/content/media/fmp4/eme/EMEAACDecoder.cpp b/content/media/fmp4/eme/EMEAACDecoder.cpp index 051eaff6c0a..db3efbbbcf2 100644 --- a/content/media/fmp4/eme/EMEAACDecoder.cpp +++ b/content/media/fmp4/eme/EMEAACDecoder.cpp @@ -127,11 +127,20 @@ EMEAACDecoder::Shutdown() void EMEAACDecoder::Decoded(const nsTArray& aPCM, - uint64_t aTimeStamp) + uint64_t aTimeStamp, + uint32_t aChannels, + uint32_t aRate) { MOZ_ASSERT(IsOnGMPThread()); - size_t numFrames = aPCM.Length() / mAudioChannels; + if (aRate == 0 || aChannels == 0) { + NS_WARNING("Invalid rate or num channels returned on GMP audio samples"); + mCallback->Error(); + return; + } + + size_t numFrames = aPCM.Length() / aChannels; + MOZ_ASSERT((aPCM.Length() % aChannels) == 0); nsAutoArrayPtr audioData(new AudioDataValue[aPCM.Length()]); for (size_t i = 0; i < aPCM.Length(); ++i) { @@ -140,7 +149,7 @@ EMEAACDecoder::Decoded(const nsTArray& aPCM, if (mMustRecaptureAudioPosition) { mAudioFrameSum = 0; - auto timestamp = UsecsToFrames(aTimeStamp, mAudioRate); + auto timestamp = UsecsToFrames(aTimeStamp, aRate); if (!timestamp.isValid()) { NS_WARNING("Invalid timestamp"); mCallback->Error(); @@ -151,7 +160,7 @@ EMEAACDecoder::Decoded(const nsTArray& aPCM, mMustRecaptureAudioPosition = false; } - auto timestamp = FramesToUsecs(mAudioFrameOffset + mAudioFrameSum, mAudioRate); + auto timestamp = FramesToUsecs(mAudioFrameOffset + mAudioFrameSum, aRate); if (!timestamp.isValid()) { NS_WARNING("Invalid timestamp on audio samples"); mCallback->Error(); @@ -159,7 +168,7 @@ EMEAACDecoder::Decoded(const nsTArray& aPCM, } mAudioFrameSum += numFrames; - auto duration = FramesToUsecs(numFrames, mAudioRate); + auto duration = FramesToUsecs(numFrames, aRate); if (!duration.isValid()) { NS_WARNING("Invalid duration on audio samples"); mCallback->Error(); @@ -171,7 +180,7 @@ EMEAACDecoder::Decoded(const nsTArray& aPCM, duration.value(), numFrames, audioData.forget(), - mAudioChannels)); + aChannels)); #ifdef LOG_SAMPLE_DECODE LOG("Decoded audio sample! timestamp=%lld duration=%lld currentLength=%u", @@ -211,6 +220,7 @@ void EMEAACDecoder::Error(GMPErr aErr) { MOZ_ASSERT(IsOnGMPThread()); + EME_LOG("EMEAACDecoder::Error"); mCallback->Error(); GmpShutdown(); } @@ -276,7 +286,7 @@ EMEAACDecoder::GmpInput(MP4Sample* aSample) } } - gmp::GMPAudioSamplesImpl samples(sample); + gmp::GMPAudioSamplesImpl samples(sample, mAudioChannels, mAudioRate); mGMP->Decode(samples); mStreamOffset = sample->byte_offset; diff --git a/content/media/fmp4/eme/EMEAACDecoder.h b/content/media/fmp4/eme/EMEAACDecoder.h index 807b4d475e3..9232cdbaa92 100644 --- a/content/media/fmp4/eme/EMEAACDecoder.h +++ b/content/media/fmp4/eme/EMEAACDecoder.h @@ -38,7 +38,9 @@ public: // GMPAudioDecoderProxyCallback implementation. virtual void Decoded(const nsTArray& aPCM, - uint64_t aTimeStamp) MOZ_OVERRIDE; + uint64_t aTimeStamp, + uint32_t aChannels, + uint32_t aRate) MOZ_OVERRIDE; virtual void InputDataExhausted() MOZ_OVERRIDE; virtual void DrainComplete() MOZ_OVERRIDE; virtual void ResetComplete() MOZ_OVERRIDE; diff --git a/content/media/fmp4/eme/EMEH264Decoder.cpp b/content/media/fmp4/eme/EMEH264Decoder.cpp index 23776b5d061..10411608131 100644 --- a/content/media/fmp4/eme/EMEH264Decoder.cpp +++ b/content/media/fmp4/eme/EMEH264Decoder.cpp @@ -15,6 +15,7 @@ #include "nsServiceManagerUtils.h" #include "prsystem.h" #include "gfx2DGlue.h" +#include "mozilla/EMELog.h" namespace mozilla { @@ -208,6 +209,7 @@ void EMEH264Decoder::Error(GMPErr aErr) { MOZ_ASSERT(IsOnGMPThread()); + EME_LOG("EMEH264Decoder::Error"); mCallback->Error(); GmpShutdown(); } diff --git a/content/media/gmp/GMPAudioDecoderChild.cpp b/content/media/gmp/GMPAudioDecoderChild.cpp index 83d7bb7586e..72ce0710d13 100644 --- a/content/media/gmp/GMPAudioDecoderChild.cpp +++ b/content/media/gmp/GMPAudioDecoderChild.cpp @@ -49,6 +49,8 @@ GMPAudioDecoderChild::Decoded(GMPAudioSamples* aDecodedSamples) samples.mData().AppendElements((int16_t*)aDecodedSamples->Buffer(), aDecodedSamples->Size() / sizeof(int16_t)); samples.mTimeStamp() = aDecodedSamples->TimeStamp(); + samples.mChannelCount() = aDecodedSamples->Channels(); + samples.mSamplesPerSecond() = aDecodedSamples->Rate(); unused << SendDecoded(samples); diff --git a/content/media/gmp/GMPAudioDecoderParent.cpp b/content/media/gmp/GMPAudioDecoderParent.cpp index 86f3705de05..0e5b4e68894 100644 --- a/content/media/gmp/GMPAudioDecoderParent.cpp +++ b/content/media/gmp/GMPAudioDecoderParent.cpp @@ -200,7 +200,10 @@ GMPAudioDecoderParent::RecvDecoded(const GMPAudioDecodedSampleData& aDecoded) return false; } - mCallback->Decoded(aDecoded.mData(), aDecoded.mTimeStamp()); + mCallback->Decoded(aDecoded.mData(), + aDecoded.mTimeStamp(), + aDecoded.mChannelCount(), + aDecoded.mSamplesPerSecond()); return true; } diff --git a/content/media/gmp/GMPAudioDecoderProxy.h b/content/media/gmp/GMPAudioDecoderProxy.h index 986a3850bc2..6b2a209c4eb 100644 --- a/content/media/gmp/GMPAudioDecoderProxy.h +++ b/content/media/gmp/GMPAudioDecoderProxy.h @@ -15,7 +15,12 @@ class GMPAudioDecoderProxyCallback : public GMPCallbackBase { public: virtual ~GMPAudioDecoderProxyCallback() {} - virtual void Decoded(const nsTArray& aPCM, uint64_t aTimeStamp) = 0; + // Note: aChannelCount and aSamplesPerSecond may not be consistent from + // one invocation to the next. + virtual void Decoded(const nsTArray& aPCM, + uint64_t aTimeStamp, + uint32_t aChannelCount, + uint32_t aSamplesPerSecond) = 0; virtual void InputDataExhausted() = 0; virtual void DrainComplete() = 0; virtual void ResetComplete() = 0; diff --git a/content/media/gmp/GMPAudioHost.cpp b/content/media/gmp/GMPAudioHost.cpp index 6f5e547f4b3..4b1b75c2922 100644 --- a/content/media/gmp/GMPAudioHost.cpp +++ b/content/media/gmp/GMPAudioHost.cpp @@ -14,6 +14,8 @@ namespace gmp { GMPAudioSamplesImpl::GMPAudioSamplesImpl(GMPAudioFormat aFormat) : mFormat(aFormat) , mTimeStamp(0) + , mChannels(0) + , mRate(0) { } @@ -21,15 +23,21 @@ GMPAudioSamplesImpl::GMPAudioSamplesImpl(const GMPAudioEncodedSampleData& aData) : mFormat(kGMPAudioEncodedSamples) , mBuffer(aData.mData()) , mTimeStamp(aData.mTimeStamp()) + , mChannels(aData.mChannelCount()) + , mRate(aData.mSamplesPerSecond()) { if (aData.mDecryptionData().mKeyId().Length() > 0) { mCrypto = new GMPEncryptedBufferDataImpl(aData.mDecryptionData()); } } -GMPAudioSamplesImpl::GMPAudioSamplesImpl(mp4_demuxer::MP4Sample* aSample) +GMPAudioSamplesImpl::GMPAudioSamplesImpl(mp4_demuxer::MP4Sample* aSample, + uint32_t aChannels, + uint32_t aRate) : mFormat(kGMPAudioEncodedSamples) , mTimeStamp(aSample->composition_timestamp) + , mChannels(aChannels) + , mRate(aRate) { mBuffer.AppendElements(aSample->data, aSample->size); if (aSample->crypto.valid) { @@ -115,6 +123,31 @@ GMPAudioSamplesImpl::RelinquishData(GMPAudioEncodedSampleData& aData) } } +uint32_t +GMPAudioSamplesImpl::Channels() const +{ + return mChannels; +} + +void +GMPAudioSamplesImpl::SetChannels(uint32_t aChannels) +{ + mChannels = aChannels; +} + +uint32_t +GMPAudioSamplesImpl::Rate() const +{ + return mRate; +} + +void +GMPAudioSamplesImpl::SetRate(uint32_t aRate) +{ + mRate = aRate; +} + + GMPErr GMPAudioHostImpl::CreateSamples(GMPAudioFormat aFormat, GMPAudioSamples** aSamples) diff --git a/content/media/gmp/GMPAudioHost.h b/content/media/gmp/GMPAudioHost.h index 32f09ca573c..975f45327e5 100644 --- a/content/media/gmp/GMPAudioHost.h +++ b/content/media/gmp/GMPAudioHost.h @@ -22,7 +22,9 @@ class GMPAudioSamplesImpl : public GMPAudioSamples { public: GMPAudioSamplesImpl(GMPAudioFormat aFormat); GMPAudioSamplesImpl(const GMPAudioEncodedSampleData& aData); - GMPAudioSamplesImpl(mp4_demuxer::MP4Sample* aSample); + GMPAudioSamplesImpl(mp4_demuxer::MP4Sample* aSample, + uint32_t aChannels, + uint32_t aRate); virtual ~GMPAudioSamplesImpl(); virtual GMPAudioFormat GetFormat() MOZ_OVERRIDE; @@ -39,11 +41,18 @@ public: void RelinquishData(GMPAudioEncodedSampleData& aData); + virtual uint32_t Channels() const MOZ_OVERRIDE; + virtual void SetChannels(uint32_t aChannels) MOZ_OVERRIDE; + virtual uint32_t Rate() const MOZ_OVERRIDE; + virtual void SetRate(uint32_t aRate) MOZ_OVERRIDE; + private: GMPAudioFormat mFormat; nsTArray mBuffer; int64_t mTimeStamp; nsAutoPtr mCrypto; + uint32_t mChannels; + uint32_t mRate; }; class GMPAudioHostImpl : public GMPAudioHost diff --git a/content/media/gmp/GMPTypes.ipdlh b/content/media/gmp/GMPTypes.ipdlh index 87c0e64040b..df5122e714d 100644 --- a/content/media/gmp/GMPTypes.ipdlh +++ b/content/media/gmp/GMPTypes.ipdlh @@ -63,12 +63,16 @@ struct GMPAudioEncodedSampleData uint8_t[] mData; uint64_t mTimeStamp; // microseconds. GMPDecryptionData mDecryptionData; + uint32_t mChannelCount; + uint32_t mSamplesPerSecond; }; struct GMPAudioDecodedSampleData { int16_t[] mData; uint64_t mTimeStamp; // microseconds. + uint32_t mChannelCount; + uint32_t mSamplesPerSecond; }; } diff --git a/content/media/gmp/gmp-api/gmp-audio-samples.h b/content/media/gmp/gmp-api/gmp-audio-samples.h index 4edbf7d8bc4..a47fc74b991 100644 --- a/content/media/gmp/gmp-api/gmp-audio-samples.h +++ b/content/media/gmp/gmp-api/gmp-audio-samples.h @@ -52,6 +52,23 @@ public: // Get metadata describing how this frame is encrypted, or nullptr if the // buffer is not encrypted. virtual const GMPEncryptedBufferMetadata* GetDecryptionData() const = 0; + + virtual uint32_t Channels() const = 0; + virtual void SetChannels(uint32_t aChannels) = 0; + + // Rate; the number of frames per second, where a "frame" is one sample for + // each channel. + // + // For IS16 samples, the number of samples should be: + // Size() / (Channels() * sizeof(int16_t)). + // + // Note: Channels() and Rate() may not be constant across a decoding + // session. For example the rate for decoded samples may be different + // than the rate advertised by the MP4 container for encoded samples + // for HE-AAC streams with SBR/PS, and an EME-GMP may need to downsample + // to satisfy DRM requirements. + virtual uint32_t Rate() const = 0; + virtual void SetRate(uint32_t aRate) = 0; }; #endif // GMP_AUDIO_FRAME_h_ From d49c15e08e7653cb7a52bc019957fe1ee636d053 Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Fri, 8 Aug 2014 14:44:04 +1200 Subject: [PATCH 030/100] Bug 1049107 - Fix build with --disable-eme. r=kentuckyfriedtakahe --- content/html/content/src/HTMLMediaElement.cpp | 2 ++ content/media/AbstractMediaDecoder.h | 4 +++ content/media/MediaDecoder.cpp | 2 ++ content/media/MediaDecoder.h | 6 ++++ content/media/MediaDecoderOwner.h | 2 ++ content/media/fmp4/MP4Decoder.cpp | 4 +++ content/media/fmp4/MP4Decoder.h | 2 ++ content/media/fmp4/MP4Reader.cpp | 15 ++++++++++ content/media/fmp4/MP4Reader.h | 1 - content/media/fmp4/PlatformDecoderModule.cpp | 4 +++ content/media/fmp4/PlatformDecoderModule.h | 2 ++ content/media/fmp4/eme/moz.build | 30 +++++++++++++++++++ content/media/fmp4/moz.build | 9 ++---- 13 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 content/media/fmp4/eme/moz.build diff --git a/content/html/content/src/HTMLMediaElement.cpp b/content/html/content/src/HTMLMediaElement.cpp index 5ecadd72b7b..e80cb5fe238 100644 --- a/content/html/content/src/HTMLMediaElement.cpp +++ b/content/html/content/src/HTMLMediaElement.cpp @@ -2653,9 +2653,11 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder, mDecoder->SetPreservesPitch(mPreservesPitch); mDecoder->SetPlaybackRate(mPlaybackRate); +#ifdef MOZ_EME if (mMediaKeys) { mDecoder->SetCDMProxy(mMediaKeys->GetCDMProxy()); } +#endif if (mPreloadAction == HTMLMediaElement::PRELOAD_METADATA) { mDecoder->SetMinimizePrerollUntilPlaybackStarts(); } diff --git a/content/media/AbstractMediaDecoder.h b/content/media/AbstractMediaDecoder.h index 452e1c4053d..40b7ec20e5d 100644 --- a/content/media/AbstractMediaDecoder.h +++ b/content/media/AbstractMediaDecoder.h @@ -25,7 +25,9 @@ class ReentrantMonitor; class VideoFrameContainer; class TimedMetadata; class MediaDecoderOwner; +#ifdef MOZ_EME class CDMProxy; +#endif typedef nsDataHashtable MetadataTags; @@ -139,8 +141,10 @@ public: uint32_t& mDecoded; }; +#ifdef MOZ_EME virtual nsresult SetCDMProxy(CDMProxy* aProxy) { return NS_ERROR_NOT_IMPLEMENTED; } virtual CDMProxy* GetCDMProxy() { return nullptr; } +#endif }; class MetadataEventRunner : public nsRunnable diff --git a/content/media/MediaDecoder.cpp b/content/media/MediaDecoder.cpp index e7dcab3c887..9c18cc2f9f1 100644 --- a/content/media/MediaDecoder.cpp +++ b/content/media/MediaDecoder.cpp @@ -1666,6 +1666,7 @@ bool MediaDecoder::CanPlayThrough() stats.mDownloadPosition > stats.mPlaybackPosition + readAheadMargin; } +#ifdef MOZ_EME nsresult MediaDecoder::SetCDMProxy(CDMProxy* aProxy) { @@ -1684,6 +1685,7 @@ MediaDecoder::GetCDMProxy() MOZ_ASSERT(OnDecodeThread() || NS_IsMainThread()); return mProxy; } +#endif #ifdef MOZ_RAW bool diff --git a/content/media/MediaDecoder.h b/content/media/MediaDecoder.h index cb37d3f1671..57577667e54 100644 --- a/content/media/MediaDecoder.h +++ b/content/media/MediaDecoder.h @@ -190,7 +190,9 @@ destroying the MediaDecoder object. #include "MediaStreamGraph.h" #include "AbstractMediaDecoder.h" #include "necko-config.h" +#ifdef MOZ_EME #include "mozilla/CDMProxy.h" +#endif class nsIStreamListener; class nsIPrincipal; @@ -850,11 +852,13 @@ public: // The decoder monitor must be held. bool IsLogicallyPlaying(); +#ifdef MOZ_EME // This takes the decoder monitor. virtual nsresult SetCDMProxy(CDMProxy* aProxy) MOZ_OVERRIDE; // Decoder monitor must be held. virtual CDMProxy* GetCDMProxy() MOZ_OVERRIDE; +#endif #ifdef MOZ_RAW static bool IsRawEnabled(); @@ -1107,7 +1111,9 @@ private: // The |RestrictedAccessMonitor| member object. RestrictedAccessMonitor mReentrantMonitor; +#ifdef MOZ_EME nsRefPtr mProxy; +#endif protected: // Data about MediaStreams that are being fed by this decoder. diff --git a/content/media/MediaDecoderOwner.h b/content/media/MediaDecoderOwner.h index 157f33baf5c..b2dd8e06299 100644 --- a/content/media/MediaDecoderOwner.h +++ b/content/media/MediaDecoderOwner.h @@ -138,11 +138,13 @@ public: // when the connection between Rtsp server and client gets lost. virtual void ResetConnectionState() = 0; +#ifdef MOZ_EME // Dispatches a "needkey" event to the HTMLMediaElement, with the // provided init data. // Main thread only. virtual void DispatchNeedKey(const nsTArray& aInitData, const nsAString& aInitDataType) = 0; +#endif }; } diff --git a/content/media/fmp4/MP4Decoder.cpp b/content/media/fmp4/MP4Decoder.cpp index e5acefa77e7..a36ceb922e8 100644 --- a/content/media/fmp4/MP4Decoder.cpp +++ b/content/media/fmp4/MP4Decoder.cpp @@ -8,7 +8,9 @@ #include "MP4Reader.h" #include "MediaDecoderStateMachine.h" #include "mozilla/Preferences.h" +#ifdef MOZ_EME #include "mozilla/CDMProxy.h" +#endif #include "prlog.h" #ifdef XP_WIN @@ -29,6 +31,7 @@ MediaDecoderStateMachine* MP4Decoder::CreateStateMachine() return new MediaDecoderStateMachine(this, new MP4Reader(this)); } +#ifdef MOZ_EME nsresult MP4Decoder::SetCDMProxy(CDMProxy* aProxy) { @@ -45,6 +48,7 @@ MP4Decoder::SetCDMProxy(CDMProxy* aProxy) } return NS_OK; } +#endif bool MP4Decoder::GetSupportedCodecs(const nsACString& aType, diff --git a/content/media/fmp4/MP4Decoder.h b/content/media/fmp4/MP4Decoder.h index b1913d22cef..31b01f5bbd2 100644 --- a/content/media/fmp4/MP4Decoder.h +++ b/content/media/fmp4/MP4Decoder.h @@ -24,7 +24,9 @@ public: virtual MediaDecoderStateMachine* CreateStateMachine(); +#ifdef MOZ_EME virtual nsresult SetCDMProxy(CDMProxy* aProxy) MOZ_OVERRIDE; +#endif // Returns true if aType is a MIME type that we can render with the // a MP4 platform decoder backend. If aCodecList is non null, diff --git a/content/media/fmp4/MP4Reader.cpp b/content/media/fmp4/MP4Reader.cpp index 69a91ec1949..daa5b3c0f1c 100644 --- a/content/media/fmp4/MP4Reader.cpp +++ b/content/media/fmp4/MP4Reader.cpp @@ -15,6 +15,10 @@ #include "mozilla/Preferences.h" #include "mozilla/dom/TimeRanges.h" +#ifdef MOZ_EME +#include "mozilla/CDMProxy.h" +#endif + using mozilla::layers::Image; using mozilla::layers::LayerManager; using mozilla::layers::LayersBackend; @@ -204,6 +208,7 @@ MP4Reader::Init(MediaDecoderReader* aCloneDonor) return NS_OK; } +#ifdef MOZ_EME class DispatchKeyNeededEvent : public nsRunnable { public: DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder, @@ -229,9 +234,11 @@ private: nsTArray mInitData; nsString mInitDataType; }; +#endif bool MP4Reader::IsWaitingMediaResources() { +#ifdef MOZ_EME nsRefPtr proxy; { ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); @@ -251,6 +258,9 @@ bool MP4Reader::IsWaitingMediaResources() LOG("MP4Reader::IsWaitingMediaResources() capsKnown=%d", caps.AreCapsKnown()); return !caps.AreCapsKnown(); } +#else + return false; +#endif } void @@ -296,6 +306,7 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo, mDemuxerInitialized = true; } if (mDemuxer->Crypto().valid) { +#ifdef MOZ_EME if (!sIsEMEEnabled) { // TODO: Need to signal DRM/EME required somehow... return NS_ERROR_FAILURE; @@ -330,6 +341,10 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo, HasVideo(), GetTaskQueue()); NS_ENSURE_TRUE(mPlatform, NS_ERROR_FAILURE); +#else + // EME not supported. + return NS_ERROR_FAILURE; +#endif } else { mPlatform = PlatformDecoderModule::Create(); NS_ENSURE_TRUE(mPlatform, NS_ERROR_FAILURE); diff --git a/content/media/fmp4/MP4Reader.h b/content/media/fmp4/MP4Reader.h index 7045c68272a..1fc8822802e 100644 --- a/content/media/fmp4/MP4Reader.h +++ b/content/media/fmp4/MP4Reader.h @@ -12,7 +12,6 @@ #include "PlatformDecoderModule.h" #include "mp4_demuxer/mp4_demuxer.h" #include "MediaTaskQueue.h" -#include "mozilla/CDMProxy.h" #include #include "mozilla/Monitor.h" diff --git a/content/media/fmp4/PlatformDecoderModule.cpp b/content/media/fmp4/PlatformDecoderModule.cpp index 3acffc29a30..06edf04f689 100644 --- a/content/media/fmp4/PlatformDecoderModule.cpp +++ b/content/media/fmp4/PlatformDecoderModule.cpp @@ -15,8 +15,10 @@ #include "AppleDecoderModule.h" #endif #include "mozilla/Preferences.h" +#ifdef MOZ_EME #include "EMEDecoderModule.h" #include "mozilla/CDMProxy.h" +#endif #include "SharedThreadPool.h" #include "MediaTaskQueue.h" @@ -70,6 +72,7 @@ CreateTaskQueue() return t->mTaskQueue.forget(); } +#ifdef MOZ_EME /* static */ PlatformDecoderModule* PlatformDecoderModule::CreateCDMWrapper(CDMProxy* aProxy, @@ -101,6 +104,7 @@ PlatformDecoderModule::CreateCDMWrapper(CDMProxy* aProxy, cdmDecodesVideo, CreateTaskQueue()); } +#endif /* static */ PlatformDecoderModule* diff --git a/content/media/fmp4/PlatformDecoderModule.h b/content/media/fmp4/PlatformDecoderModule.h index 7f4f85b09f8..629a8714ebb 100644 --- a/content/media/fmp4/PlatformDecoderModule.h +++ b/content/media/fmp4/PlatformDecoderModule.h @@ -66,6 +66,7 @@ public: // This is called on the decode task queue. static PlatformDecoderModule* Create(); +#ifdef MOZ_EME // Creates a PlatformDecoderModule that uses a CDMProxy to decrypt or // decrypt-and-decode EME encrypted content. If the CDM only decrypts and // does not decode, we create a PDM and use that to create MediaDataDecoders @@ -75,6 +76,7 @@ public: bool aHasAudio, bool aHasVideo, MediaTaskQueue* aTaskQueue); +#endif // Called to shutdown the decoder module and cleanup state. The PDM // is deleted immediately after Shutdown() is called. Shutdown() is diff --git a/content/media/fmp4/eme/moz.build b/content/media/fmp4/eme/moz.build new file mode 100644 index 00000000000..d22505cf61f --- /dev/null +++ b/content/media/fmp4/eme/moz.build @@ -0,0 +1,30 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +EXPORTS += [ + 'EMEAACDecoder.h', + 'EMEDecoderModule.h', + 'EMEH264Decoder.h', +] + +UNIFIED_SOURCES += [ + 'EMEAACDecoder.cpp', + 'EMEDecoderModule.cpp', + 'EMEH264Decoder.cpp', +] + +include('/ipc/chromium/chromium-config.mozbuild') + +LOCAL_INCLUDES += [ + '../base', +] + +FINAL_LIBRARY = 'xul' + +FAIL_ON_WARNINGS = True + +if CONFIG['OS_ARCH'] == 'WINNT': + DEFINES['NOMINMAX'] = True diff --git a/content/media/fmp4/moz.build b/content/media/fmp4/moz.build index 3af0be01fff..fc830bf542c 100644 --- a/content/media/fmp4/moz.build +++ b/content/media/fmp4/moz.build @@ -5,9 +5,6 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXPORTS += [ - 'eme/EMEAACDecoder.h', - 'eme/EMEDecoderModule.h', - 'eme/EMEH264Decoder.h', 'MP4Decoder.h', 'MP4Reader.h', 'PlatformDecoderModule.h', @@ -15,9 +12,6 @@ EXPORTS += [ UNIFIED_SOURCES += [ 'BlankDecoderModule.cpp', - 'eme/EMEAACDecoder.cpp', - 'eme/EMEDecoderModule.cpp', - 'eme/EMEH264Decoder.cpp', 'PlatformDecoderModule.cpp', ] @@ -29,6 +23,9 @@ SOURCES += [ if CONFIG['MOZ_WMF']: DIRS += [ 'wmf' ]; +if CONFIG['MOZ_EME']: + DIRS += ['eme'] + if CONFIG['MOZ_FFMPEG']: EXPORTS += [ 'ffmpeg/FFmpegRuntimeLinker.h', From b9d0c685701f54250d4d2175301517274e6625e0 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Thu, 7 Aug 2014 11:33:14 -0500 Subject: [PATCH 031/100] Bug 1042772. Set the dirty rect relative to the current frame, not the reference frame. r=roc The offsetToReferenceFrame is to the reference frame for this, since we are transformed we are the reference frame, so the offset was 0,0. So the computation still produced correct results. --- layout/generic/nsFrame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index f18b3e8e713..a501de1ed27 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -2105,7 +2105,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, clipState.Restore(); // Revert to the dirtyrect coming in from the parent, without our transform // taken into account. - buildingDisplayList.SetDirtyRect(aDirtyRect + offsetToReferenceFrame); + buildingDisplayList.SetDirtyRect(aDirtyRect); if (Preserves3DChildren()) { WrapPreserve3DList(this, aBuilder, &resultList); From a9bd164ce0dece164231732aa3eddc7daedc3edb Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Thu, 7 Aug 2014 11:33:16 -0500 Subject: [PATCH 032/100] Bug 1042772. offsetToReferenceFrame is always zero when we use it. Remove it. r=mattwoodrow --- layout/generic/nsFrame.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index a501de1ed27..00dc3fcbfce 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1922,8 +1922,6 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, AutoSaveRestoreBlendMode autoRestoreBlendMode(*aBuilder); aBuilder->SetContainsBlendModes(BlendModeSet()); - nsPoint offsetToReferenceFrame = aBuilder->ToReferenceFrame(this); - if (isTransformed) { const nsRect overflow = GetVisualOverflowRectRelativeToSelf(); if (aBuilder->IsForPainting() && @@ -1934,10 +1932,9 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, return; } - dirtyRect += offsetToReferenceFrame; nsRect untransformedDirtyRect; if (nsDisplayTransform::UntransformRect(dirtyRect, overflow, this, - offsetToReferenceFrame, &untransformedDirtyRect)) { + nsPoint(0,0), &untransformedDirtyRect)) { dirtyRect = untransformedDirtyRect; } else { NS_WARNING("Unable to untransform dirty rect!"); From 8a29924e53b24197563e22a5ab8162d2623b9e58 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Thu, 7 Aug 2014 11:33:18 -0500 Subject: [PATCH 033/100] Bug 1042772. Update the reference frame and current frame offset when moving to outside a transform so that we can use the correct offset to compute the initial visible rect for wrap list display items. r=roc * * * The current reference frame is still the same as our reference frame because we set and restore it in nsFrame::BuildDisplayListForChild before this. So we need to actually compute it. --- layout/base/nsDisplayList.cpp | 6 ++++-- layout/base/nsDisplayList.h | 4 ++++ layout/generic/nsFrame.cpp | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 860ac2b9c8c..8fedee235f9 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -3006,7 +3006,8 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder, mToReferenceFrame = i->ToReferenceFrame(); } } - mVisibleRect = aBuilder->GetDirtyRect() + mToReferenceFrame; + mVisibleRect = aBuilder->GetDirtyRect() + + aBuilder->GetCurrentFrameOffsetToReferenceFrame(); } nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder, @@ -3035,7 +3036,8 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder, mToReferenceFrame = aItem->ToReferenceFrame(); } } - mVisibleRect = aBuilder->GetDirtyRect() + mToReferenceFrame; + mVisibleRect = aBuilder->GetDirtyRect() + + aBuilder->GetCurrentFrameOffsetToReferenceFrame(); } nsDisplayWrapList::~nsDisplayWrapList() { diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 062f63af216..8121a7ef47a 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -533,6 +533,10 @@ public: void SetDirtyRect(const nsRect& aRect) { mBuilder->mDirtyRect = aRect; } + void SetReferenceFrameAndCurrentOffset(const nsIFrame* aFrame, const nsPoint& aOffset) { + mBuilder->mCurrentReferenceFrame = aFrame; + mBuilder->mCurrentOffsetToReferenceFrame = aOffset; + } ~AutoBuildingDisplayList() { mBuilder->mCurrentFrame = mPrevFrame; mBuilder->mCurrentReferenceFrame = mPrevReferenceFrame; diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 00dc3fcbfce..1a01ddbdbb3 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -2103,6 +2103,12 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, // Revert to the dirtyrect coming in from the parent, without our transform // taken into account. buildingDisplayList.SetDirtyRect(aDirtyRect); + // Revert to the outer reference frame and offset because all display + // items we create from now on are outside the transform. + const nsIFrame* outerReferenceFrame = + aBuilder->FindReferenceFrameFor(nsLayoutUtils::GetTransformRootFrame(this)); + buildingDisplayList.SetReferenceFrameAndCurrentOffset(outerReferenceFrame, + GetOffsetToCrossDoc(outerReferenceFrame)); if (Preserves3DChildren()) { WrapPreserve3DList(this, aBuilder, &resultList); From a55c0cbad5bd8c87432607286ac3338df1b16c52 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Mon, 4 Aug 2014 15:29:55 +1200 Subject: [PATCH 034/100] Bug 1048110 - Expand complex visible regions if we're going to be resampling when using tiling. r=Bas --- gfx/layers/Layers.h | 16 ++++----- gfx/layers/client/ClientTiledThebesLayer.cpp | 36 ++++++++++++------- gfx/layers/client/ClientTiledThebesLayer.h | 2 ++ gfx/layers/client/TiledContentClient.cpp | 6 ++++ gfx/layers/composite/CompositableHost.h | 11 +----- gfx/layers/composite/ContentHost.cpp | 4 +-- gfx/layers/composite/ContentHost.h | 13 ++++--- gfx/layers/composite/ImageHost.cpp | 3 +- gfx/layers/composite/ImageHost.h | 3 +- gfx/layers/composite/ThebesLayerComposite.cpp | 16 +-------- gfx/layers/composite/ThebesLayerComposite.h | 3 -- gfx/layers/composite/TiledContentHost.cpp | 22 ++++++++---- gfx/layers/composite/TiledContentHost.h | 3 +- 13 files changed, 67 insertions(+), 71 deletions(-) diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index fe93bb44d70..6ab050e1711 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -1434,6 +1434,14 @@ public: virtual int32_t GetMaxLayerSize() { return Manager()->GetMaxTextureSize(); } + /** + * Returns true if this layer's effective transform is not just + * a translation by integers, or if this layer or some ancestor layer + * is marked as having a transform that may change without a full layer + * transaction. + */ + bool MayResample(); + protected: Layer(LayerManager* aManager, void* aImplData); @@ -1482,14 +1490,6 @@ protected: const gfxRect& aSnapRect, gfx::Matrix* aResidualTransform); - /** - * Returns true if this layer's effective transform is not just - * a translation by integers, or if this layer or some ancestor layer - * is marked as having a transform that may change without a full layer - * transaction. - */ - bool MayResample(); - LayerManager* mManager; ContainerLayer* mParent; Layer* mNextSibling; diff --git a/gfx/layers/client/ClientTiledThebesLayer.cpp b/gfx/layers/client/ClientTiledThebesLayer.cpp index 004c174d86e..9672e155334 100644 --- a/gfx/layers/client/ClientTiledThebesLayer.cpp +++ b/gfx/layers/client/ClientTiledThebesLayer.cpp @@ -195,6 +195,7 @@ ClientTiledThebesLayer::UseFastPath() bool ClientTiledThebesLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion, + const nsIntRegion& aVisibleRegion, LayerManager::DrawThebesLayerCallback aCallback, void* aCallbackData) { @@ -213,7 +214,7 @@ ClientTiledThebesLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion, // We clip the old valid region to the visible region, as it only gets // used to decide stale content (currently valid and previously visible) nsIntRegion oldValidRegion = mContentClient->mTiledBuffer.GetValidRegion(); - oldValidRegion.And(oldValidRegion, mVisibleRegion); + oldValidRegion.And(oldValidRegion, aVisibleRegion); if (!mPaintData.mCriticalDisplayPort.IsEmpty()) { oldValidRegion.And(oldValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort)); } @@ -226,7 +227,7 @@ ClientTiledThebesLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion, // Otherwise do a non-progressive paint - mValidRegion = mVisibleRegion; + mValidRegion = aVisibleRegion; if (!mPaintData.mCriticalDisplayPort.IsEmpty()) { mValidRegion.And(mValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort)); } @@ -241,14 +242,15 @@ ClientTiledThebesLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion, bool ClientTiledThebesLayer::RenderLowPrecision(nsIntRegion& aInvalidRegion, + const nsIntRegion& aVisibleRegion, LayerManager::DrawThebesLayerCallback aCallback, void* aCallbackData) { // Render the low precision buffer, if the visible region is larger than the // critical display port. - if (!nsIntRegion(LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort)).Contains(mVisibleRegion)) { + if (!nsIntRegion(LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort)).Contains(aVisibleRegion)) { nsIntRegion oldValidRegion = mContentClient->mLowPrecisionTiledBuffer.GetValidRegion(); - oldValidRegion.And(oldValidRegion, mVisibleRegion); + oldValidRegion.And(oldValidRegion, aVisibleRegion); bool updatedBuffer = false; @@ -261,12 +263,12 @@ ClientTiledThebesLayer::RenderLowPrecision(nsIntRegion& aInvalidRegion, oldValidRegion.SetEmpty(); mLowPrecisionValidRegion.SetEmpty(); mContentClient->mLowPrecisionTiledBuffer.SetFrameResolution(mPaintData.mResolution); - aInvalidRegion = mVisibleRegion; + aInvalidRegion = aVisibleRegion; } // Invalidate previously valid content that is no longer visible if (mPaintData.mLowPrecisionPaintCount == 1) { - mLowPrecisionValidRegion.And(mLowPrecisionValidRegion, mVisibleRegion); + mLowPrecisionValidRegion.And(mLowPrecisionValidRegion, aVisibleRegion); } mPaintData.mLowPrecisionPaintCount++; @@ -335,8 +337,14 @@ ClientTiledThebesLayer::RenderLayer() TILING_LOG("TILING %p: Initial valid region %s\n", this, Stringify(mValidRegion).c_str()); TILING_LOG("TILING %p: Initial low-precision valid region %s\n", this, Stringify(mLowPrecisionValidRegion).c_str()); + nsIntRegion neededRegion = mVisibleRegion; + if (neededRegion.GetNumRects() > 1 && + MayResample()) { + neededRegion = neededRegion.GetBounds(); + } + nsIntRegion invalidRegion; - invalidRegion.Sub(mVisibleRegion, mValidRegion); + invalidRegion.Sub(neededRegion, mValidRegion); if (invalidRegion.IsEmpty()) { EndPaint(); return; @@ -351,7 +359,7 @@ ClientTiledThebesLayer::RenderLayer() // In some cases we can take a fast path and just be done with it. if (UseFastPath()) { TILING_LOG("TILING %p: Taking fast-path\n", this); - mValidRegion = mVisibleRegion; + mValidRegion = neededRegion; mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion, callback, data); ClientManager()->Hold(this); mContentClient->UseTiledLayerBuffer(TiledContentClient::TILED_BUFFER); @@ -368,7 +376,7 @@ ClientTiledThebesLayer::RenderLayer() // Make sure that tiles that fall outside of the visible region or outside of the // critical displayport are discarded on the first update. Also make sure that we // only draw stuff inside the critical displayport on the first update. - mValidRegion.And(mValidRegion, mVisibleRegion); + mValidRegion.And(mValidRegion, neededRegion); if (!mPaintData.mCriticalDisplayPort.IsEmpty()) { mValidRegion.And(mValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort)); invalidRegion.And(invalidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort)); @@ -387,12 +395,14 @@ ClientTiledThebesLayer::RenderLayer() if (gfxPrefs::UseLowPrecisionBuffer()) { // Calculate the invalid region for the low precision buffer. Make sure // to remove the valid high-precision area so we don't double-paint it. - lowPrecisionInvalidRegion.Sub(mVisibleRegion, mLowPrecisionValidRegion); + lowPrecisionInvalidRegion.Sub(neededRegion, mLowPrecisionValidRegion); lowPrecisionInvalidRegion.Sub(lowPrecisionInvalidRegion, mValidRegion); } TILING_LOG("TILING %p: Low-precision invalid region %s\n", this, Stringify(lowPrecisionInvalidRegion).c_str()); - bool updatedHighPrecision = RenderHighPrecision(invalidRegion, callback, data); + bool updatedHighPrecision = RenderHighPrecision(invalidRegion, + neededRegion, + callback, data); if (updatedHighPrecision) { ClientManager()->Hold(this); mContentClient->UseTiledLayerBuffer(TiledContentClient::TILED_BUFFER); @@ -423,7 +433,9 @@ ClientTiledThebesLayer::RenderLayer() return; } - bool updatedLowPrecision = RenderLowPrecision(lowPrecisionInvalidRegion, callback, data); + bool updatedLowPrecision = RenderLowPrecision(lowPrecisionInvalidRegion, + neededRegion, + callback, data); if (updatedLowPrecision) { ClientManager()->Hold(this); mContentClient->UseTiledLayerBuffer(TiledContentClient::LOW_PRECISION_TILED_BUFFER); diff --git a/gfx/layers/client/ClientTiledThebesLayer.h b/gfx/layers/client/ClientTiledThebesLayer.h index 0582c982e8a..91ee0494ebd 100644 --- a/gfx/layers/client/ClientTiledThebesLayer.h +++ b/gfx/layers/client/ClientTiledThebesLayer.h @@ -103,6 +103,7 @@ private: * This function returns true if it updated the paint buffer. */ bool RenderHighPrecision(nsIntRegion& aInvalidRegion, + const nsIntRegion& aVisibleRegion, LayerManager::DrawThebesLayerCallback aCallback, void* aCallbackData); @@ -111,6 +112,7 @@ private: * This function returns true if it updated the paint buffer. */ bool RenderLowPrecision(nsIntRegion& aInvalidRegion, + const nsIntRegion& aVisibleRegion, LayerManager::DrawThebesLayerCallback aCallback, void* aCallbackData); diff --git a/gfx/layers/client/TiledContentClient.cpp b/gfx/layers/client/TiledContentClient.cpp index 964b04d36d3..56ccf397995 100644 --- a/gfx/layers/client/TiledContentClient.cpp +++ b/gfx/layers/client/TiledContentClient.cpp @@ -327,6 +327,12 @@ ClientTiledLayerBuffer::GetContentType(SurfaceMode* aMode) const content = gfxContentType::COLOR; } #endif + } else if (mode == SurfaceMode::SURFACE_OPAQUE) { + if (mThebesLayer->GetVisibleRegion().GetNumRects() > 1 && + mThebesLayer->MayResample()) { + mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA; + content = gfxContentType::COLOR_ALPHA; + } } if (aMode) { diff --git a/gfx/layers/composite/CompositableHost.h b/gfx/layers/composite/CompositableHost.h index 8f6b3cddebb..33a2f4b16ef 100644 --- a/gfx/layers/composite/CompositableHost.h +++ b/gfx/layers/composite/CompositableHost.h @@ -37,14 +37,6 @@ class DataSourceSurface; namespace layers { -// Some properties of a Layer required for tiling -struct TiledLayerProperties -{ - nsIntRegion mVisibleRegion; - nsIntRegion mValidRegion; - CSSToScreenScale mEffectiveResolution; -}; - class Layer; class SurfaceDescriptor; class Compositor; @@ -121,8 +113,7 @@ public: const gfx::Matrix4x4& aTransform, const gfx::Filter& aFilter, const gfx::Rect& aClipRect, - const nsIntRegion* aVisibleRegion = nullptr, - TiledLayerProperties* aLayerProperties = nullptr) = 0; + const nsIntRegion* aVisibleRegion = nullptr) = 0; /** * Update the content host. diff --git a/gfx/layers/composite/ContentHost.cpp b/gfx/layers/composite/ContentHost.cpp index d54ec10a446..72d4dd7495d 100644 --- a/gfx/layers/composite/ContentHost.cpp +++ b/gfx/layers/composite/ContentHost.cpp @@ -27,7 +27,6 @@ namespace layers { ContentHostBase::ContentHostBase(const TextureInfo& aTextureInfo) : ContentHost(aTextureInfo) - , mPaintWillResample(false) , mInitialised(false) {} @@ -41,8 +40,7 @@ ContentHostBase::Composite(EffectChain& aEffectChain, const gfx::Matrix4x4& aTransform, const Filter& aFilter, const Rect& aClipRect, - const nsIntRegion* aVisibleRegion, - TiledLayerProperties* aLayerProperties) + const nsIntRegion* aVisibleRegion) { NS_ASSERTION(aVisibleRegion, "Requires a visible region"); diff --git a/gfx/layers/composite/ContentHost.h b/gfx/layers/composite/ContentHost.h index 40580fcea78..e5aa7156aa9 100644 --- a/gfx/layers/composite/ContentHost.h +++ b/gfx/layers/composite/ContentHost.h @@ -64,12 +64,16 @@ public: const nsIntRegion& aOldValidRegionBack, nsIntRegion* aUpdatedRegionBack) = 0; - virtual void SetPaintWillResample(bool aResample) { } + virtual void SetPaintWillResample(bool aResample) { mPaintWillResample = aResample; } + bool PaintWillResample() { return mPaintWillResample; } protected: ContentHost(const TextureInfo& aTextureInfo) : CompositableHost(aTextureInfo) + , mPaintWillResample(false) {} + + bool mPaintWillResample; }; /** @@ -97,10 +101,7 @@ public: const gfx::Matrix4x4& aTransform, const gfx::Filter& aFilter, const gfx::Rect& aClipRect, - const nsIntRegion* aVisibleRegion = nullptr, - TiledLayerProperties* aLayerProperties = nullptr); - - virtual void SetPaintWillResample(bool aResample) { mPaintWillResample = aResample; } + const nsIntRegion* aVisibleRegion = nullptr); virtual NewTextureSource* GetTextureSource() = 0; virtual NewTextureSource* GetTextureSourceOnWhite() = 0; @@ -113,11 +114,9 @@ protected: return mBufferRect.TopLeft() - mBufferRotation; } - bool PaintWillResample() { return mPaintWillResample; } nsIntRect mBufferRect; nsIntPoint mBufferRotation; - bool mPaintWillResample; bool mInitialised; }; diff --git a/gfx/layers/composite/ImageHost.cpp b/gfx/layers/composite/ImageHost.cpp index 2025fe0b493..4e67991e23e 100644 --- a/gfx/layers/composite/ImageHost.cpp +++ b/gfx/layers/composite/ImageHost.cpp @@ -65,8 +65,7 @@ ImageHost::Composite(EffectChain& aEffectChain, const gfx::Matrix4x4& aTransform, const gfx::Filter& aFilter, const gfx::Rect& aClipRect, - const nsIntRegion* aVisibleRegion, - TiledLayerProperties* aLayerProperties) + const nsIntRegion* aVisibleRegion) { if (!GetCompositor()) { // should only happen when a tab is dragged to another window and diff --git a/gfx/layers/composite/ImageHost.h b/gfx/layers/composite/ImageHost.h index 5002a00a52a..bae8ed77207 100644 --- a/gfx/layers/composite/ImageHost.h +++ b/gfx/layers/composite/ImageHost.h @@ -50,8 +50,7 @@ public: const gfx::Matrix4x4& aTransform, const gfx::Filter& aFilter, const gfx::Rect& aClipRect, - const nsIntRegion* aVisibleRegion = nullptr, - TiledLayerProperties* aLayerProperties = nullptr) MOZ_OVERRIDE; + const nsIntRegion* aVisibleRegion = nullptr) MOZ_OVERRIDE; virtual void UseTextureHost(TextureHost* aTexture) MOZ_OVERRIDE; diff --git a/gfx/layers/composite/ThebesLayerComposite.cpp b/gfx/layers/composite/ThebesLayerComposite.cpp index 3b4870f3f83..e47aaeb4adc 100644 --- a/gfx/layers/composite/ThebesLayerComposite.cpp +++ b/gfx/layers/composite/ThebesLayerComposite.cpp @@ -38,7 +38,6 @@ ThebesLayerComposite::ThebesLayerComposite(LayerManagerComposite *aManager) : ThebesLayer(aManager, nullptr) , LayerComposite(aManager) , mBuffer(nullptr) - , mRequiresTiledProperties(false) { MOZ_COUNT_CTOR(ThebesLayerComposite); mImplData = static_cast(this); @@ -135,13 +134,6 @@ ThebesLayerComposite::RenderLayer(const nsIntRect& aClipRect) const nsIntRegion& visibleRegion = GetEffectiveVisibleRegion(); - TiledLayerProperties tiledLayerProps; - if (mRequiresTiledProperties) { - tiledLayerProps.mVisibleRegion = visibleRegion; - tiledLayerProps.mEffectiveResolution = GetEffectiveResolution(); - tiledLayerProps.mValidRegion = mValidRegion; - } - mBuffer->SetPaintWillResample(MayResample()); mBuffer->Composite(effectChain, @@ -149,15 +141,9 @@ ThebesLayerComposite::RenderLayer(const nsIntRect& aClipRect) GetEffectiveTransform(), GetEffectFilter(), clipRect, - &visibleRegion, - mRequiresTiledProperties ? &tiledLayerProps - : nullptr); + &visibleRegion); mBuffer->BumpFlashCounter(); - if (mRequiresTiledProperties) { - mValidRegion = tiledLayerProps.mValidRegion; - } - mCompositeManager->GetCompositor()->MakeCurrent(); } diff --git a/gfx/layers/composite/ThebesLayerComposite.h b/gfx/layers/composite/ThebesLayerComposite.h index 49fbc399422..0a09112cf82 100644 --- a/gfx/layers/composite/ThebesLayerComposite.h +++ b/gfx/layers/composite/ThebesLayerComposite.h @@ -65,8 +65,6 @@ public: virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; } - void EnsureTiled() { mRequiresTiledProperties = true; } - virtual void InvalidateRegion(const nsIntRegion& aRegion) { NS_RUNTIMEABORT("ThebesLayerComposites can't fill invalidated regions"); @@ -92,7 +90,6 @@ private: private: RefPtr mBuffer; - bool mRequiresTiledProperties; }; } /* layers */ diff --git a/gfx/layers/composite/TiledContentHost.cpp b/gfx/layers/composite/TiledContentHost.cpp index 13847958a08..6d4aee59ce5 100644 --- a/gfx/layers/composite/TiledContentHost.cpp +++ b/gfx/layers/composite/TiledContentHost.cpp @@ -241,7 +241,6 @@ TiledContentHost::Attach(Layer* aLayer, AttachFlags aFlags /* = NO_FLAGS */) { CompositableHost::Attach(aLayer, aCompositor, aFlags); - static_cast(aLayer)->EnsureTiled(); } void @@ -324,11 +323,8 @@ TiledContentHost::Composite(EffectChain& aEffectChain, const gfx::Matrix4x4& aTransform, const gfx::Filter& aFilter, const gfx::Rect& aClipRect, - const nsIntRegion* aVisibleRegion /* = nullptr */, - TiledLayerProperties* aLayerProperties /* = nullptr */) + const nsIntRegion* aVisibleRegion /* = nullptr */) { - MOZ_ASSERT(aLayerProperties, "aLayerProperties required for TiledContentHost"); - if (mPendingUpload) { mTiledBuffer.SetCompositor(mCompositor); mTiledBuffer.Upload(); @@ -374,13 +370,25 @@ TiledContentHost::Composite(EffectChain& aEffectChain, (aOpacity == 1.0f && backgroundColor.a == 1.0f) ? gfxPrefs::LowPrecisionOpacity() : 1.0f; + nsIntRegion tmpRegion; + const nsIntRegion* renderRegion; + if (PaintWillResample()) { + // If we're resampling, then the texture image will contain exactly the + // entire visible region's bounds, and we should draw it all in one quad + // to avoid unexpected aliasing. + tmpRegion = aVisibleRegion->GetBounds(); + renderRegion = &tmpRegion; + } else { + renderRegion = aVisibleRegion; + } + // Render the low and high precision buffers. RenderLayerBuffer(mLowPrecisionTiledBuffer, lowPrecisionOpacityReduction < 1.0f ? &backgroundColor : nullptr, aEffectChain, lowPrecisionOpacityReduction * aOpacity, - aFilter, aClipRect, aLayerProperties->mVisibleRegion, aTransform); + aFilter, aClipRect, *renderRegion, aTransform); RenderLayerBuffer(mTiledBuffer, nullptr, aEffectChain, aOpacity, aFilter, - aClipRect, aLayerProperties->mVisibleRegion, aTransform); + aClipRect, *renderRegion, aTransform); // Now release the old buffer if it had double-buffered tiles, as we can // guarantee that they're no longer on the screen (and so any locks that may diff --git a/gfx/layers/composite/TiledContentHost.h b/gfx/layers/composite/TiledContentHost.h index db595e7d82f..1c29651a455 100644 --- a/gfx/layers/composite/TiledContentHost.h +++ b/gfx/layers/composite/TiledContentHost.h @@ -223,8 +223,7 @@ public: const gfx::Matrix4x4& aTransform, const gfx::Filter& aFilter, const gfx::Rect& aClipRect, - const nsIntRegion* aVisibleRegion = nullptr, - TiledLayerProperties* aLayerProperties = nullptr); + const nsIntRegion* aVisibleRegion = nullptr); virtual CompositableType GetType() { return CompositableType::BUFFER_TILED; } From 96dccaf15ae47ba8a9c4fb7904f29a449ec5076d Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Tue, 5 Aug 2014 12:17:47 +1200 Subject: [PATCH 035/100] Bug 1048110 - Pad visible regions out by 1 pixel to avoid sampling from invalid content. r=Bas --- gfx/2d/BaseRect.h | 14 ++++++++++++++ gfx/layers/client/ClientTiledThebesLayer.cpp | 15 ++++++++++++--- gfx/layers/client/TiledContentClient.cpp | 3 +-- layout/reftests/bugs/reftest.list | 6 +++--- layout/reftests/css-gradients/reftest.list | 2 +- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/gfx/2d/BaseRect.h b/gfx/2d/BaseRect.h index c6b91d533e2..fff44ffba52 100644 --- a/gfx/2d/BaseRect.h +++ b/gfx/2d/BaseRect.h @@ -208,6 +208,20 @@ struct BaseRect { } void Inflate(const SizeT& aSize) { Inflate(aSize.width, aSize.height); } + void InflateToMultiple(const SizeT& aMultiple) + { + T xMost = XMost(); + T yMost = YMost(); + + x = static_cast(floor(x / aMultiple.width)) * aMultiple.width; + y = static_cast(floor(y / aMultiple.height)) * aMultiple.height; + xMost = static_cast(ceil(x / aMultiple.width)) * aMultiple.width; + yMost = static_cast(ceil(y / aMultiple.height)) * aMultiple.height; + + width = xMost - x; + height = yMost - y; + } + void Deflate(T aD) { Deflate(aD, aD); } void Deflate(T aDx, T aDy) { diff --git a/gfx/layers/client/ClientTiledThebesLayer.cpp b/gfx/layers/client/ClientTiledThebesLayer.cpp index 9672e155334..cd83742f426 100644 --- a/gfx/layers/client/ClientTiledThebesLayer.cpp +++ b/gfx/layers/client/ClientTiledThebesLayer.cpp @@ -338,9 +338,18 @@ ClientTiledThebesLayer::RenderLayer() TILING_LOG("TILING %p: Initial low-precision valid region %s\n", this, Stringify(mLowPrecisionValidRegion).c_str()); nsIntRegion neededRegion = mVisibleRegion; - if (neededRegion.GetNumRects() > 1 && - MayResample()) { - neededRegion = neededRegion.GetBounds(); + if (MayResample()) { + // If we're resampling then bilinear filtering can read up to 1 pixel + // outside of our texture coords. Make the visible region a single rect, + // and pad it out by 1 pixel (restricted to tile boundaries) so that + // we always have valid content or transparent pixels to sample from. + nsIntRect bounds = neededRegion.GetBounds(); + nsIntRect wholeTiles = bounds; + wholeTiles.Inflate(nsIntSize(gfxPrefs::LayersTileWidth(), gfxPrefs::LayersTileHeight())); + nsIntRect padded = bounds; + padded.Inflate(1); + padded.IntersectRect(padded, wholeTiles); + neededRegion = padded; } nsIntRegion invalidRegion; diff --git a/gfx/layers/client/TiledContentClient.cpp b/gfx/layers/client/TiledContentClient.cpp index 56ccf397995..184d041adc3 100644 --- a/gfx/layers/client/TiledContentClient.cpp +++ b/gfx/layers/client/TiledContentClient.cpp @@ -328,8 +328,7 @@ ClientTiledLayerBuffer::GetContentType(SurfaceMode* aMode) const } #endif } else if (mode == SurfaceMode::SURFACE_OPAQUE) { - if (mThebesLayer->GetVisibleRegion().GetNumRects() > 1 && - mThebesLayer->MayResample()) { + if (mThebesLayer->MayResample()) { mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA; content = gfxContentType::COLOR_ALPHA; } diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index d63b9745a63..af567f66200 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1650,9 +1650,9 @@ skip-if(Android||B2G) random-if(winWidget) == 632781-verybig.html 632781-ref.htm == 633344-1.html 633344-1-ref.html == 634232-1.html 634232-1-ref.html fails-if(Android&&AndroidVersion<17&&AndroidVersion!=10) == 635302-1.html 635302-1-ref.html -skip-if(B2G) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,11) == 635373-1.html 635373-1-ref.html -skip-if(B2G) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,15) == 635373-2.html 635373-2-ref.html -skip-if(B2G) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,15) == 635373-3.html 635373-3-ref.html +skip-if(B2G) random-if(d2d) fuzzy-if(winWidget&&!d2d,1,11) == 635373-1.html 635373-1-ref.html +skip-if(B2G) random-if(d2d) fuzzy-if(winWidget&&!d2d,1,15) == 635373-2.html 635373-2-ref.html +skip-if(B2G) random-if(d2d) fuzzy-if(winWidget&&!d2d,1,15) == 635373-3.html 635373-3-ref.html HTTP(..) == 635639-1.html 635639-1-ref.html HTTP(..) == 635639-2.html 635639-2-ref.html random == 637597-1.html 637597-1-ref.html # bug 637597 was never really fixed! diff --git a/layout/reftests/css-gradients/reftest.list b/layout/reftests/css-gradients/reftest.list index 61fa9c52b90..80cd71cf422 100644 --- a/layout/reftests/css-gradients/reftest.list +++ b/layout/reftests/css-gradients/reftest.list @@ -68,7 +68,7 @@ fuzzy(3,7860) fuzzy-if(cocoaWidget,5,89041) fuzzy-if(azureSkiaGL,2,90000) == rad == radial-position-1a.html radial-position-1-ref.html == radial-position-1b.html radial-position-1-ref.html fuzzy-if(azureQuartz,4,22317) == radial-shape-closest-corner-1a.html radial-shape-closest-corner-1-ref.html -fuzzy(1,232) fuzzy-if(cocoaWidget,3,460) fuzzy-if(azureQuartz,4,22608) == radial-shape-closest-corner-1b.html radial-shape-closest-corner-1-ref.html +fuzzy(1,238) fuzzy-if(cocoaWidget,3,460) fuzzy-if(azureQuartz,4,22608) == radial-shape-closest-corner-1b.html radial-shape-closest-corner-1-ref.html fuzzy-if(azureQuartz,2,41171) == radial-shape-closest-corner-1c.html radial-shape-closest-corner-1-ref.html fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) fuzzy-if(Android,17,3880) == radial-shape-closest-side-1a.html radial-shape-closest-side-1-ref.html fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) fuzzy-if(Android,17,3880) == radial-shape-closest-side-1b.html radial-shape-closest-side-1-ref.html From 159bb89d43f7300b5da218c0e263266527038f4b Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 7 Aug 2014 19:20:29 -0700 Subject: [PATCH 036/100] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/36ac74d01b48 Author: James Lal Desc: Merge pull request #22637 from lightsofapollo/reland-webcomp-off Bug 1038439 - Remove web components preference from Gaia. r=vingtetun ======== https://hg.mozilla.org/integration/gaia-central/rev/10f057bd0e09 Author: William Chen Desc: Bug 1038439 - Remove web components preference from Gaia. r=vingtetun --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 403518b056f..5c4503bb61c 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "41b3413a893fef684b380bb344f9d4a5f491f858", + "revision": "36ac74d01b488dd9cb518ff27472b3052a810912", "repo_path": "/integration/gaia-central" } From b23c3de5535e62e6a7b7b0f817b7a13248212dd7 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 7 Aug 2014 19:26:28 -0700 Subject: [PATCH 037/100] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 2719dda3401..550dbe2f8da 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 16e4857dc92..ec482cdfcde 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 0a73b811109..5eef974d290 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 2719dda3401..550dbe2f8da 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 66d3eb9c1a3..28dd45ea150 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index a41c0c3cb85..2b311877cfc 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index bcdba27aaf6..580f57ba7e6 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 23d3fc02ba4..b6bb8676682 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 3bd15ab6b55..07a0a5e85e4 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 4ff0f8426a5ded7775e6fdb135cac539f7aff6e3 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 7 Aug 2014 19:35:26 -0700 Subject: [PATCH 038/100] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ======== https://hg.mozilla.org/integration/gaia-central/rev/46634893ce7d Author: Hubert Figuière Desc: Merge pull request #22531 from hfiguiere/bug1007774 Bug 1007774 - Have the performance goal provided by device and output. r=eli ======== https://hg.mozilla.org/integration/gaia-central/rev/90b5ede0cc91 Author: Hubert Figuière Desc: Bug 1007774 - Have the performance goal provided by device and output. --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 5c4503bb61c..4abde782660 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "36ac74d01b488dd9cb518ff27472b3052a810912", + "revision": "46634893ce7d48f7ec6146d1ea41d0a5ab133447", "repo_path": "/integration/gaia-central" } From dbfd39d252d6ff577cf1278c48a43cc43e9b94f0 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 7 Aug 2014 19:39:26 -0700 Subject: [PATCH 039/100] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 550dbe2f8da..3f48c53c963 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index ec482cdfcde..01ae5d65262 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 5eef974d290..418698377ac 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 550dbe2f8da..3f48c53c963 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 28dd45ea150..9a8727789d2 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 2b311877cfc..9d10669e764 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 580f57ba7e6..9657f5954a4 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index b6bb8676682..b0d9748986c 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 07a0a5e85e4..15f7feb02c8 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From ad63501283cc2b652a245484690d728643159c41 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 7 Aug 2014 19:51:08 -0700 Subject: [PATCH 040/100] Bumping gaia.json for 3 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/f432fa4d6b84 Author: Kevin Grandon Desc: Merge pull request #22645 from KevinGrandon/reland_bug_1049569 Bug 1049569 - Sanitize e.me app url results ======== https://hg.mozilla.org/integration/gaia-central/rev/ed7b699351c4 Author: Kevin Grandon Desc: Bug 1049569 - Follow-up, update collection test identifier r=me ======== https://hg.mozilla.org/integration/gaia-central/rev/71f12bc9739f Author: Chris Lord Desc: Bug 1049569 - Sanitize e.me app url results. r=kgrandon e.me app result urls often miss the trailing slash. Sanitize them so we get better bookmarking behaviour in the system browser. --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 4abde782660..1444a52812b 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "46634893ce7d48f7ec6146d1ea41d0a5ab133447", + "revision": "f432fa4d6b84eaade8d2dc87d40f9137fe445754", "repo_path": "/integration/gaia-central" } From 4dcfd262cac555c2d15395d361ab96628b94c74a Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 7 Aug 2014 19:54:11 -0700 Subject: [PATCH 041/100] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 3f48c53c963..44f4821e80f 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 01ae5d65262..f1b8ed78a46 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 418698377ac..7d961389881 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 3f48c53c963..44f4821e80f 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 9a8727789d2..f51864950b2 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 9d10669e764..9c65004e66a 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 9657f5954a4..ee0706edda0 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index b0d9748986c..c82a579ea82 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 15f7feb02c8..cd9c0e49350 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From f8a1030aa4a456a81c03db5f27164176135525c7 Mon Sep 17 00:00:00 2001 From: Edgar Chen Date: Wed, 6 Aug 2014 15:35:34 +0800 Subject: [PATCH 042/100] Bug 1048581 - Part 1: Voice() and Data() won't need to check mProvider is valid or not. r=smaug --- dom/mobileconnection/src/MobileConnection.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/dom/mobileconnection/src/MobileConnection.cpp b/dom/mobileconnection/src/MobileConnection.cpp index 5a0601bf19b..bdd5cf78378 100644 --- a/dom/mobileconnection/src/MobileConnection.cpp +++ b/dom/mobileconnection/src/MobileConnection.cpp @@ -214,20 +214,12 @@ MobileConnection::GetLastKnownHomeNetwork(nsString& aRetVal) const MobileConnectionInfo* MobileConnection::Voice() const { - if (!mProvider) { - return nullptr; - } - return mVoice; } MobileConnectionInfo* MobileConnection::Data() const { - if (!mProvider) { - return nullptr; - } - return mData; } From 101875eb4e75daae343720f115df9203929b6e1d Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Thu, 7 Aug 2014 11:55:31 +1200 Subject: [PATCH 043/100] Bug 1049303 - Avoid an invalid cast to ClientThebesLayer when we're using tiling. r=Bas --- gfx/layers/client/ClientContainerLayer.h | 6 +----- gfx/layers/client/ClientLayerManager.h | 1 + gfx/layers/client/ClientThebesLayer.cpp | 2 +- gfx/layers/client/ClientThebesLayer.h | 4 ++-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/gfx/layers/client/ClientContainerLayer.h b/gfx/layers/client/ClientContainerLayer.h index 4a8ace8d404..23329689c0a 100644 --- a/gfx/layers/client/ClientContainerLayer.h +++ b/gfx/layers/client/ClientContainerLayer.h @@ -66,11 +66,7 @@ public: continue; } - if (child->GetType() != TYPE_THEBES) { - ToClientLayer(child)->RenderLayer(); - } else { - static_cast(child)->RenderLayer(&readback); - } + ToClientLayer(child)->RenderLayerWithReadback(&readback); if (!ClientManager()->GetRepeatTransaction() && !child->GetInvalidRegion().IsEmpty()) { diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h index d9e414bd4ca..f5dd326738a 100644 --- a/gfx/layers/client/ClientLayerManager.h +++ b/gfx/layers/client/ClientLayerManager.h @@ -334,6 +334,7 @@ public: virtual void ClearCachedResources() { } virtual void RenderLayer() = 0; + virtual void RenderLayerWithReadback(ReadbackProcessor *aReadback) { RenderLayer(); } virtual ClientThebesLayer* AsThebes() { return nullptr; } diff --git a/gfx/layers/client/ClientThebesLayer.cpp b/gfx/layers/client/ClientThebesLayer.cpp index 8dd569d2003..da7b8cd0405 100644 --- a/gfx/layers/client/ClientThebesLayer.cpp +++ b/gfx/layers/client/ClientThebesLayer.cpp @@ -105,7 +105,7 @@ ClientThebesLayer::PaintThebes() } void -ClientThebesLayer::RenderLayer(ReadbackProcessor *aReadback) +ClientThebesLayer::RenderLayerWithReadback(ReadbackProcessor *aReadback) { if (GetMaskLayer()) { ToClientLayer(GetMaskLayer())->RenderLayer(); diff --git a/gfx/layers/client/ClientThebesLayer.h b/gfx/layers/client/ClientThebesLayer.h index ca63a9bf563..b5864ef448f 100644 --- a/gfx/layers/client/ClientThebesLayer.h +++ b/gfx/layers/client/ClientThebesLayer.h @@ -69,9 +69,9 @@ public: mValidRegion.Sub(mValidRegion, mInvalidRegion); } - virtual void RenderLayer() { RenderLayer(nullptr); } + virtual void RenderLayer() { RenderLayerWithReadback(nullptr); } - virtual void RenderLayer(ReadbackProcessor *aReadback); + virtual void RenderLayerWithReadback(ReadbackProcessor *aReadback) MOZ_OVERRIDE; virtual void ClearCachedResources() { From 0edc9ee1d526839a122f91834e758521c4c5bf5f Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Fri, 8 Aug 2014 16:38:17 +1200 Subject: [PATCH 044/100] Bug 969222 - Don't find a new frame pointer unless the previous one was deleted. r=smaug --- layout/base/nsPresShell.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index b0e60152b64..61b05832734 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -6983,12 +6983,16 @@ PresShell::HandleEvent(nsIFrame* aFrame, nsIDocument::UnlockPointer(); } + nsWeakFrame weakFrame(frame); { // scope for scriptBlocker. nsAutoScriptBlocker scriptBlocker; GetRootPresShell()->GetDocument()-> EnumerateSubDocuments(FlushThrottledStyles, nullptr); } - frame = GetNearestFrameContainingPresShell(this); + + if (!weakFrame.IsAlive()) { + frame = GetNearestFrameContainingPresShell(this); + } } NS_WARN_IF_FALSE(frame, "Nothing to handle this event!"); From 91cef4e9afc1f8816b15f8724a4ee3483ecd1820 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 7 Aug 2014 21:52:04 -0700 Subject: [PATCH 045/100] Bug 1049998 - Flatten browser/fuel/{public,src}/ directories. r=mak --HG-- rename : browser/fuel/src/fuelApplication.js => browser/fuel/fuelApplication.js rename : browser/fuel/src/fuelApplication.manifest => browser/fuel/fuelApplication.manifest rename : browser/fuel/public/fuelIApplication.idl => browser/fuel/fuelIApplication.idl --- browser/fuel/{src => }/fuelApplication.js | 2 +- browser/fuel/{src => }/fuelApplication.manifest | 0 browser/fuel/{public => }/fuelIApplication.idl | 0 browser/fuel/moz.build | 15 ++++++++++++++- browser/fuel/public/moz.build | 12 ------------ browser/fuel/src/moz.build | 13 ------------- 6 files changed, 15 insertions(+), 27 deletions(-) rename browser/fuel/{src => }/fuelApplication.js (99%) rename browser/fuel/{src => }/fuelApplication.manifest (100%) rename browser/fuel/{public => }/fuelIApplication.idl (100%) delete mode 100644 browser/fuel/public/moz.build delete mode 100644 browser/fuel/src/moz.build diff --git a/browser/fuel/src/fuelApplication.js b/browser/fuel/fuelApplication.js similarity index 99% rename from browser/fuel/src/fuelApplication.js rename to browser/fuel/fuelApplication.js index 0b249296f32..a2136c0265c 100644 --- a/browser/fuel/src/fuelApplication.js +++ b/browser/fuel/fuelApplication.js @@ -729,7 +729,7 @@ var ApplicationFactory = { }; -#include ../../../toolkit/components/exthelper/extApplication.js +#include ../../toolkit/components/exthelper/extApplication.js //================================================= // Application constructor diff --git a/browser/fuel/src/fuelApplication.manifest b/browser/fuel/fuelApplication.manifest similarity index 100% rename from browser/fuel/src/fuelApplication.manifest rename to browser/fuel/fuelApplication.manifest diff --git a/browser/fuel/public/fuelIApplication.idl b/browser/fuel/fuelIApplication.idl similarity index 100% rename from browser/fuel/public/fuelIApplication.idl rename to browser/fuel/fuelIApplication.idl diff --git a/browser/fuel/moz.build b/browser/fuel/moz.build index 4f82470ff9e..10562b0f81e 100644 --- a/browser/fuel/moz.build +++ b/browser/fuel/moz.build @@ -4,5 +4,18 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['public', 'src'] BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] + +XPIDL_SOURCES += [ + 'fuelIApplication.idl', +] + +XPIDL_MODULE = 'fuel' + +EXTRA_COMPONENTS += [ + 'fuelApplication.manifest', +] + +EXTRA_PP_COMPONENTS += [ + 'fuelApplication.js', +] diff --git a/browser/fuel/public/moz.build b/browser/fuel/public/moz.build deleted file mode 100644 index fe0f7e3ac31..00000000000 --- a/browser/fuel/public/moz.build +++ /dev/null @@ -1,12 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -XPIDL_SOURCES += [ - 'fuelIApplication.idl', -] - -XPIDL_MODULE = 'fuel' - diff --git a/browser/fuel/src/moz.build b/browser/fuel/src/moz.build deleted file mode 100644 index 5edbd70ece4..00000000000 --- a/browser/fuel/src/moz.build +++ /dev/null @@ -1,13 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -EXTRA_COMPONENTS += [ - 'fuelApplication.manifest', -] - -EXTRA_PP_COMPONENTS += [ - 'fuelApplication.js', -] From e21712765cd4e8d123311f87e5b4b7e6e5734f62 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 7 Aug 2014 21:52:04 -0700 Subject: [PATCH 046/100] Bug 1047877 - Flatten modules/libpref/{public,src}/ directories. r=bsmedberg --HG-- rename : modules/libpref/src/Makefile.in => modules/libpref/Makefile.in rename : modules/libpref/src/Preferences.cpp => modules/libpref/Preferences.cpp rename : modules/libpref/public/Preferences.h => modules/libpref/Preferences.h rename : modules/libpref/src/init/all.js => modules/libpref/init/all.js rename : modules/libpref/public/nsIPrefBranch.idl => modules/libpref/nsIPrefBranch.idl rename : modules/libpref/public/nsIPrefBranch2.idl => modules/libpref/nsIPrefBranch2.idl rename : modules/libpref/public/nsIPrefBranchInternal.idl => modules/libpref/nsIPrefBranchInternal.idl rename : modules/libpref/public/nsIPrefLocalizedString.idl => modules/libpref/nsIPrefLocalizedString.idl rename : modules/libpref/public/nsIPrefService.idl => modules/libpref/nsIPrefService.idl rename : modules/libpref/public/nsIRelativeFilePref.idl => modules/libpref/nsIRelativeFilePref.idl rename : modules/libpref/src/nsPrefBranch.cpp => modules/libpref/nsPrefBranch.cpp rename : modules/libpref/src/nsPrefBranch.h => modules/libpref/nsPrefBranch.h rename : modules/libpref/src/nsPrefsFactory.cpp => modules/libpref/nsPrefsFactory.cpp rename : modules/libpref/src/prefapi.cpp => modules/libpref/prefapi.cpp rename : modules/libpref/src/prefapi.h => modules/libpref/prefapi.h rename : modules/libpref/src/prefapi_private_data.h => modules/libpref/prefapi_private_data.h rename : modules/libpref/src/prefread.cpp => modules/libpref/prefread.cpp rename : modules/libpref/src/prefread.h => modules/libpref/prefread.h --- modules/libpref/{src => }/Makefile.in | 0 modules/libpref/{src => }/Preferences.cpp | 0 modules/libpref/{public => }/Preferences.h | 0 modules/libpref/{src => }/init/all.js | 0 modules/libpref/moz.build | 36 ++++++++++++++++++- .../libpref/{public => }/nsIPrefBranch.idl | 0 .../libpref/{public => }/nsIPrefBranch2.idl | 0 .../{public => }/nsIPrefBranchInternal.idl | 0 .../{public => }/nsIPrefLocalizedString.idl | 0 .../libpref/{public => }/nsIPrefService.idl | 0 .../{public => }/nsIRelativeFilePref.idl | 0 modules/libpref/{src => }/nsPrefBranch.cpp | 0 modules/libpref/{src => }/nsPrefBranch.h | 0 modules/libpref/{src => }/nsPrefsFactory.cpp | 0 modules/libpref/{src => }/prefapi.cpp | 0 modules/libpref/{src => }/prefapi.h | 0 .../libpref/{src => }/prefapi_private_data.h | 0 modules/libpref/{src => }/prefread.cpp | 0 modules/libpref/{src => }/prefread.h | 0 modules/libpref/public/moz.build | 21 ----------- modules/libpref/src/moz.build | 26 -------------- 21 files changed, 35 insertions(+), 48 deletions(-) rename modules/libpref/{src => }/Makefile.in (100%) rename modules/libpref/{src => }/Preferences.cpp (100%) rename modules/libpref/{public => }/Preferences.h (100%) rename modules/libpref/{src => }/init/all.js (100%) rename modules/libpref/{public => }/nsIPrefBranch.idl (100%) rename modules/libpref/{public => }/nsIPrefBranch2.idl (100%) rename modules/libpref/{public => }/nsIPrefBranchInternal.idl (100%) rename modules/libpref/{public => }/nsIPrefLocalizedString.idl (100%) rename modules/libpref/{public => }/nsIPrefService.idl (100%) rename modules/libpref/{public => }/nsIRelativeFilePref.idl (100%) rename modules/libpref/{src => }/nsPrefBranch.cpp (100%) rename modules/libpref/{src => }/nsPrefBranch.h (100%) rename modules/libpref/{src => }/nsPrefsFactory.cpp (100%) rename modules/libpref/{src => }/prefapi.cpp (100%) rename modules/libpref/{src => }/prefapi.h (100%) rename modules/libpref/{src => }/prefapi_private_data.h (100%) rename modules/libpref/{src => }/prefread.cpp (100%) rename modules/libpref/{src => }/prefread.h (100%) delete mode 100644 modules/libpref/public/moz.build delete mode 100644 modules/libpref/src/moz.build diff --git a/modules/libpref/src/Makefile.in b/modules/libpref/Makefile.in similarity index 100% rename from modules/libpref/src/Makefile.in rename to modules/libpref/Makefile.in diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/Preferences.cpp similarity index 100% rename from modules/libpref/src/Preferences.cpp rename to modules/libpref/Preferences.cpp diff --git a/modules/libpref/public/Preferences.h b/modules/libpref/Preferences.h similarity index 100% rename from modules/libpref/public/Preferences.h rename to modules/libpref/Preferences.h diff --git a/modules/libpref/src/init/all.js b/modules/libpref/init/all.js similarity index 100% rename from modules/libpref/src/init/all.js rename to modules/libpref/init/all.js diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build index 47e64e62391..4f9a562a20c 100644 --- a/modules/libpref/moz.build +++ b/modules/libpref/moz.build @@ -4,6 +4,40 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['public', 'src'] TEST_DIRS += ['test'] +XPIDL_SOURCES += [ + 'nsIPrefBranch.idl', + 'nsIPrefBranch2.idl', + 'nsIPrefBranchInternal.idl', + 'nsIPrefLocalizedString.idl', + 'nsIPrefService.idl', + 'nsIRelativeFilePref.idl', +] + +XPIDL_MODULE = 'pref' + +EXPORTS.mozilla += [ + 'Preferences.h', +] + +UNIFIED_SOURCES += [ + 'nsPrefBranch.cpp', + 'nsPrefsFactory.cpp', + 'Preferences.cpp', + 'prefread.cpp', +] + +# prefapi.cpp cannot be built in unified mode because it uses plarena.h +SOURCES += [ + 'prefapi.cpp', +] + +MSVC_ENABLE_PGO = True + +include('/ipc/chromium/chromium-config.mozbuild') + +FINAL_LIBRARY = 'xul' + +DEFINES['OS_ARCH'] = CONFIG['OS_ARCH'] +DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT'] diff --git a/modules/libpref/public/nsIPrefBranch.idl b/modules/libpref/nsIPrefBranch.idl similarity index 100% rename from modules/libpref/public/nsIPrefBranch.idl rename to modules/libpref/nsIPrefBranch.idl diff --git a/modules/libpref/public/nsIPrefBranch2.idl b/modules/libpref/nsIPrefBranch2.idl similarity index 100% rename from modules/libpref/public/nsIPrefBranch2.idl rename to modules/libpref/nsIPrefBranch2.idl diff --git a/modules/libpref/public/nsIPrefBranchInternal.idl b/modules/libpref/nsIPrefBranchInternal.idl similarity index 100% rename from modules/libpref/public/nsIPrefBranchInternal.idl rename to modules/libpref/nsIPrefBranchInternal.idl diff --git a/modules/libpref/public/nsIPrefLocalizedString.idl b/modules/libpref/nsIPrefLocalizedString.idl similarity index 100% rename from modules/libpref/public/nsIPrefLocalizedString.idl rename to modules/libpref/nsIPrefLocalizedString.idl diff --git a/modules/libpref/public/nsIPrefService.idl b/modules/libpref/nsIPrefService.idl similarity index 100% rename from modules/libpref/public/nsIPrefService.idl rename to modules/libpref/nsIPrefService.idl diff --git a/modules/libpref/public/nsIRelativeFilePref.idl b/modules/libpref/nsIRelativeFilePref.idl similarity index 100% rename from modules/libpref/public/nsIRelativeFilePref.idl rename to modules/libpref/nsIRelativeFilePref.idl diff --git a/modules/libpref/src/nsPrefBranch.cpp b/modules/libpref/nsPrefBranch.cpp similarity index 100% rename from modules/libpref/src/nsPrefBranch.cpp rename to modules/libpref/nsPrefBranch.cpp diff --git a/modules/libpref/src/nsPrefBranch.h b/modules/libpref/nsPrefBranch.h similarity index 100% rename from modules/libpref/src/nsPrefBranch.h rename to modules/libpref/nsPrefBranch.h diff --git a/modules/libpref/src/nsPrefsFactory.cpp b/modules/libpref/nsPrefsFactory.cpp similarity index 100% rename from modules/libpref/src/nsPrefsFactory.cpp rename to modules/libpref/nsPrefsFactory.cpp diff --git a/modules/libpref/src/prefapi.cpp b/modules/libpref/prefapi.cpp similarity index 100% rename from modules/libpref/src/prefapi.cpp rename to modules/libpref/prefapi.cpp diff --git a/modules/libpref/src/prefapi.h b/modules/libpref/prefapi.h similarity index 100% rename from modules/libpref/src/prefapi.h rename to modules/libpref/prefapi.h diff --git a/modules/libpref/src/prefapi_private_data.h b/modules/libpref/prefapi_private_data.h similarity index 100% rename from modules/libpref/src/prefapi_private_data.h rename to modules/libpref/prefapi_private_data.h diff --git a/modules/libpref/src/prefread.cpp b/modules/libpref/prefread.cpp similarity index 100% rename from modules/libpref/src/prefread.cpp rename to modules/libpref/prefread.cpp diff --git a/modules/libpref/src/prefread.h b/modules/libpref/prefread.h similarity index 100% rename from modules/libpref/src/prefread.h rename to modules/libpref/prefread.h diff --git a/modules/libpref/public/moz.build b/modules/libpref/public/moz.build deleted file mode 100644 index 0ba94350165..00000000000 --- a/modules/libpref/public/moz.build +++ /dev/null @@ -1,21 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -XPIDL_SOURCES += [ - 'nsIPrefBranch.idl', - 'nsIPrefBranch2.idl', - 'nsIPrefBranchInternal.idl', - 'nsIPrefLocalizedString.idl', - 'nsIPrefService.idl', - 'nsIRelativeFilePref.idl', -] - -XPIDL_MODULE = 'pref' - -EXPORTS.mozilla += [ - 'Preferences.h', -] - diff --git a/modules/libpref/src/moz.build b/modules/libpref/src/moz.build deleted file mode 100644 index f863f76d9cb..00000000000 --- a/modules/libpref/src/moz.build +++ /dev/null @@ -1,26 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -UNIFIED_SOURCES += [ - 'nsPrefBranch.cpp', - 'nsPrefsFactory.cpp', - 'Preferences.cpp', - 'prefread.cpp', -] - -# prefapi.cpp cannot be built in unified mode because it uses plarena.h -SOURCES += [ - 'prefapi.cpp', -] - -MSVC_ENABLE_PGO = True - -include('/ipc/chromium/chromium-config.mozbuild') - -FINAL_LIBRARY = 'xul' - -DEFINES['OS_ARCH'] = CONFIG['OS_ARCH'] -DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT'] From dab04d7491d4e3b7554b6fbc731c3636aa3caedb Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 7 Aug 2014 21:52:04 -0700 Subject: [PATCH 047/100] Bug 1047878 - Flatten profile/dirserviceprovider/{public,src}/ directories. r=bsmedberg --HG-- rename : profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp => profile/dirserviceprovider/nsProfileDirServiceProvider.cpp rename : profile/dirserviceprovider/public/nsProfileDirServiceProvider.h => profile/dirserviceprovider/nsProfileDirServiceProvider.h rename : profile/dirserviceprovider/src/nsProfileLock.cpp => profile/dirserviceprovider/nsProfileLock.cpp rename : profile/dirserviceprovider/src/nsProfileLock.h => profile/dirserviceprovider/nsProfileLock.h rename : profile/dirserviceprovider/src/nsProfileStringTypes.h => profile/dirserviceprovider/nsProfileStringTypes.h --- profile/dirserviceprovider/moz.build | 15 ++++++++++++++- .../{src => }/nsProfileDirServiceProvider.cpp | 0 .../{public => }/nsProfileDirServiceProvider.h | 0 .../{src => }/nsProfileLock.cpp | 0 .../{src => }/nsProfileLock.h | 0 .../{src => }/nsProfileStringTypes.h | 0 profile/dirserviceprovider/public/moz.build | 10 ---------- profile/dirserviceprovider/src/moz.build | 17 ----------------- toolkit/profile/moz.build | 4 ++-- 9 files changed, 16 insertions(+), 30 deletions(-) rename profile/dirserviceprovider/{src => }/nsProfileDirServiceProvider.cpp (100%) rename profile/dirserviceprovider/{public => }/nsProfileDirServiceProvider.h (100%) rename profile/dirserviceprovider/{src => }/nsProfileLock.cpp (100%) rename profile/dirserviceprovider/{src => }/nsProfileLock.h (100%) rename profile/dirserviceprovider/{src => }/nsProfileStringTypes.h (100%) delete mode 100644 profile/dirserviceprovider/public/moz.build delete mode 100644 profile/dirserviceprovider/src/moz.build diff --git a/profile/dirserviceprovider/moz.build b/profile/dirserviceprovider/moz.build index 76218104c01..75b600909dc 100644 --- a/profile/dirserviceprovider/moz.build +++ b/profile/dirserviceprovider/moz.build @@ -4,5 +4,18 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['public', 'src'] +EXPORTS += [ + 'nsProfileDirServiceProvider.h', +] +UNIFIED_SOURCES += ['nsProfileDirServiceProvider.cpp'] +if CONFIG['MOZ_PROFILELOCKING']: + UNIFIED_SOURCES += ['nsProfileLock.cpp'] + +LIBRARY_NAME = 'profdirserviceprovidersa_s' + +FORCE_STATIC_LIB = True + +DEFINES['XPCOM_GLUE'] = 1 + +DISABLE_STL_WRAPPING = True diff --git a/profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp b/profile/dirserviceprovider/nsProfileDirServiceProvider.cpp similarity index 100% rename from profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp rename to profile/dirserviceprovider/nsProfileDirServiceProvider.cpp diff --git a/profile/dirserviceprovider/public/nsProfileDirServiceProvider.h b/profile/dirserviceprovider/nsProfileDirServiceProvider.h similarity index 100% rename from profile/dirserviceprovider/public/nsProfileDirServiceProvider.h rename to profile/dirserviceprovider/nsProfileDirServiceProvider.h diff --git a/profile/dirserviceprovider/src/nsProfileLock.cpp b/profile/dirserviceprovider/nsProfileLock.cpp similarity index 100% rename from profile/dirserviceprovider/src/nsProfileLock.cpp rename to profile/dirserviceprovider/nsProfileLock.cpp diff --git a/profile/dirserviceprovider/src/nsProfileLock.h b/profile/dirserviceprovider/nsProfileLock.h similarity index 100% rename from profile/dirserviceprovider/src/nsProfileLock.h rename to profile/dirserviceprovider/nsProfileLock.h diff --git a/profile/dirserviceprovider/src/nsProfileStringTypes.h b/profile/dirserviceprovider/nsProfileStringTypes.h similarity index 100% rename from profile/dirserviceprovider/src/nsProfileStringTypes.h rename to profile/dirserviceprovider/nsProfileStringTypes.h diff --git a/profile/dirserviceprovider/public/moz.build b/profile/dirserviceprovider/public/moz.build deleted file mode 100644 index c2e5f85c22f..00000000000 --- a/profile/dirserviceprovider/public/moz.build +++ /dev/null @@ -1,10 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -EXPORTS += [ - 'nsProfileDirServiceProvider.h', -] - diff --git a/profile/dirserviceprovider/src/moz.build b/profile/dirserviceprovider/src/moz.build deleted file mode 100644 index 688df62d006..00000000000 --- a/profile/dirserviceprovider/src/moz.build +++ /dev/null @@ -1,17 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -UNIFIED_SOURCES += ['nsProfileDirServiceProvider.cpp'] -if CONFIG['MOZ_PROFILELOCKING']: - UNIFIED_SOURCES += ['nsProfileLock.cpp'] - -LIBRARY_NAME = 'profdirserviceprovidersa_s' - -FORCE_STATIC_LIB = True - -DEFINES['XPCOM_GLUE'] = 1 - -DISABLE_STL_WRAPPING = True diff --git a/toolkit/profile/moz.build b/toolkit/profile/moz.build index b474aadbfa7..ad68c715e87 100644 --- a/toolkit/profile/moz.build +++ b/toolkit/profile/moz.build @@ -14,7 +14,7 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'toolkitprofile' -UNIFIED_SOURCES += [ TOPSRCDIR + '/profile/dirserviceprovider/src/nsProfileLock.cpp' ] +UNIFIED_SOURCES += [ TOPSRCDIR + '/profile/dirserviceprovider/nsProfileLock.cpp' ] UNIFIED_SOURCES += [ 'nsToolkitProfileService.cpp' @@ -22,7 +22,7 @@ UNIFIED_SOURCES += [ LOCAL_INCLUDES += [ '../xre', - '/profile/dirserviceprovider/src', + '/profile/dirserviceprovider', ] FAIL_ON_WARNINGS = True From bc031a9a096d8e8ed0c28634f26bc49e14aa413a Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 7 Aug 2014 21:52:04 -0700 Subject: [PATCH 048/100] Bug 1047878 - Flatten profile/public/ directory. r=bsmedberg --HG-- rename : profile/public/notifications.txt => profile/notifications.txt rename : profile/public/nsIProfileUnlocker.idl => profile/nsIProfileUnlocker.idl --- profile/moz.build | 7 ++++++- profile/{public => }/notifications.txt | 0 profile/{public => }/nsIProfileUnlocker.idl | 0 profile/public/moz.build | 12 ------------ 4 files changed, 6 insertions(+), 13 deletions(-) rename profile/{public => }/notifications.txt (100%) rename profile/{public => }/nsIProfileUnlocker.idl (100%) delete mode 100644 profile/public/moz.build diff --git a/profile/moz.build b/profile/moz.build index e7d4b0fdefe..33109d729b8 100644 --- a/profile/moz.build +++ b/profile/moz.build @@ -4,5 +4,10 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['public', 'dirserviceprovider'] +DIRS += ['dirserviceprovider'] +XPIDL_SOURCES += [ + 'nsIProfileUnlocker.idl', +] + +XPIDL_MODULE = 'profile' diff --git a/profile/public/notifications.txt b/profile/notifications.txt similarity index 100% rename from profile/public/notifications.txt rename to profile/notifications.txt diff --git a/profile/public/nsIProfileUnlocker.idl b/profile/nsIProfileUnlocker.idl similarity index 100% rename from profile/public/nsIProfileUnlocker.idl rename to profile/nsIProfileUnlocker.idl diff --git a/profile/public/moz.build b/profile/public/moz.build deleted file mode 100644 index 5ba881bfcd7..00000000000 --- a/profile/public/moz.build +++ /dev/null @@ -1,12 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -XPIDL_SOURCES += [ - 'nsIProfileUnlocker.idl', -] - -XPIDL_MODULE = 'profile' - From 483b5a000bdbcd8c5bef8e6bd89e677e45102a62 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 7 Aug 2014 21:52:05 -0700 Subject: [PATCH 049/100] Bug 1050001 - Remove `#ifdef DEBUG_username` lines in editor/. r=ehsan --- editor/libeditor/base/nsEditor.cpp | 3 -- editor/libeditor/html/nsHTMLDataTransfer.cpp | 12 ------- editor/libeditor/html/nsHTMLEditor.cpp | 10 ------ editor/libeditor/html/nsHTMLURIRefObject.cpp | 12 +------ editor/libeditor/html/nsTableEditor.cpp | 16 +-------- editor/libeditor/text/nsInternetCiter.cpp | 33 ----------------- editor/libeditor/text/nsPlaintextEditor.cpp | 15 +------- editor/txtsvc/nsTextServicesDocument.cpp | 38 -------------------- editor/txtsvc/nsTextServicesDocument.h | 5 --- 9 files changed, 3 insertions(+), 141 deletions(-) diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index 9c6017372df..5e5a84ce7fa 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -2323,9 +2323,6 @@ nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode) } } else { // Do we ever get here? -#if DEBUG_cmanske - printf("Attribute in sourceAttribute has empty value in nsEditor::CloneAttributes()\n"); -#endif } } } diff --git a/editor/libeditor/html/nsHTMLDataTransfer.cpp b/editor/libeditor/html/nsHTMLDataTransfer.cpp index e75be6c1621..53c24a11afa 100644 --- a/editor/libeditor/html/nsHTMLDataTransfer.cpp +++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp @@ -1135,10 +1135,6 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable nsAutoString flavor; flavor.AssignWithConversion(bestFlavor); nsAutoString stuffToPaste; -#ifdef DEBUG_clipboard - printf("Got flavor [%s]\n", bestFlavor.get()); -#endif - bool isSafe = IsSafeToInsertData(aSourceDoc); if (0 == nsCRT::strcmp(bestFlavor, kFileMime) || @@ -1646,9 +1642,6 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation(int32_t aSelectionType) if (flav && 0 == nsCRT::strcmp(flav, kUnicodeMime)) { -#ifdef DEBUG_clipboard - printf("Got flavor [%s]\n", flav); -#endif nsCOMPtr textDataObj = do_QueryInterface(genericDataObj); if (textDataObj && len > 0) { @@ -1732,11 +1725,6 @@ nsHTMLEditor::InsertTextWithQuotations(const nsAString &aStringToInsert) // inserting from curHunk to lineStart then returning. const nsAString &curHunk = Substring(hunkStart, lineStart); nsCOMPtr dummyNode; -#ifdef DEBUG_akkana_verbose - printf("==== Inserting text as %squoted: ---\n%s---\n", - curHunkIsQuoted ? "" : "non-", - NS_LossyConvertUTF16toASCII(curHunk).get()); -#endif if (curHunkIsQuoted) rv = InsertAsPlaintextQuotation(curHunk, false, getter_AddRefs(dummyNode)); diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index df4703ce06e..094756459f6 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -1553,16 +1553,6 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, bool aDeleteSele // XXX: ERROR_HANDLING bad XPCOM usage if (NS_SUCCEEDED(res) && NS_SUCCEEDED(selection->GetAnchorOffset(&offsetForInsert)) && parentSelectedNode) { -#ifdef DEBUG_cmanske - { - nsAutoString name; - parentSelectedNode->GetNodeName(name); - printf("InsertElement: Anchor node of selection: "); - wprintf(name.get()); - printf(" Offset: %d\n", offsetForInsert); - } -#endif - // Adjust position based on the node we are going to insert. NormalizeEOLInsertPosition(node, address_of(parentSelectedNode), &offsetForInsert); diff --git a/editor/libeditor/html/nsHTMLURIRefObject.cpp b/editor/libeditor/html/nsHTMLURIRefObject.cpp index e5dd430358d..3ae85bf4e29 100644 --- a/editor/libeditor/html/nsHTMLURIRefObject.cpp +++ b/editor/libeditor/html/nsHTMLURIRefObject.cpp @@ -126,10 +126,7 @@ nsHTMLURIRefObject::GetNextURI(nsAString & aURI) NS_ENSURE_TRUE(mAttributeCnt, NS_ERROR_FAILURE); mCurAttrIndex = 0; } -#ifdef DEBUG_akkana - printf("Looking at tag '%s'\n", - NS_LossyConvertUTF16toASCII(tagName).get()); -#endif + while (mCurAttrIndex < mAttributeCnt) { nsCOMPtr attrNode; @@ -141,10 +138,6 @@ nsHTMLURIRefObject::GetNextURI(nsAString & aURI) NS_ENSURE_SUCCESS(rv, rv); // href >> A, AREA, BASE, LINK -#ifdef DEBUG_akkana - printf("Trying to match attribute '%s'\n", - NS_LossyConvertUTF16toASCII(curAttr).get()); -#endif if (MATCHES(curAttr, "href")) { if (!MATCHES(tagName, "a") && !MATCHES(tagName, "area") @@ -248,9 +241,6 @@ nsHTMLURIRefObject::RewriteAllURIs(const nsAString & aOldPat, const nsAString & aNewPat, bool aMakeRel) { -#ifdef DEBUG_akkana - printf("Can't rewrite URIs yet\n"); -#endif return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/editor/libeditor/html/nsTableEditor.cpp b/editor/libeditor/html/nsTableEditor.cpp index 259c9da4f98..a7e8a2bde94 100644 --- a/editor/libeditor/html/nsTableEditor.cpp +++ b/editor/libeditor/html/nsTableEditor.cpp @@ -349,9 +349,7 @@ nsHTMLEditor::GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode **aRowNode) NS_ADDREF(*aRowNode); return NS_OK; } -#ifdef DEBUG_cmanske - printf("GetNextRow: firstChild of row's parent's sibling is not a TR!\n"); -#endif + // We arrive here only if a table section has no children // or first child of section is not a row (bad HTML or more "_moz_text" nodes!) // So look for another section sibling @@ -457,11 +455,6 @@ nsHTMLEditor::InsertTableColumn(int32_t aNumber, bool aAfter) nsCOMPtr rowNode; for ( rowIndex = 0; rowIndex < rowCount; rowIndex++) { -#ifdef DEBUG_cmanske - if (rowIndex == rowCount-1) - printf(" ***InsertTableColumn: Inserting cell at last row: %d\n", rowIndex); -#endif - if (startColIndex < colCount) { // We are inserting before an existing column @@ -3023,10 +3016,6 @@ nsHTMLEditor::GetNextSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell) // We found a selected cell if (*aCell) break; -#ifdef DEBUG_cmanske - else - printf("GetNextSelectedCell: Collapsed range found\n"); -#endif // If we didn't find a cell, continue to next range in selection } @@ -3091,9 +3080,6 @@ nsHTMLEditor::SetSelectionAfterTableEdit(nsIDOMElement* aTable, int32_t aRow, in if (!selection) { -#ifdef DEBUG_cmanske - printf("Selection not found after table manipulation!\n"); -#endif return NS_ERROR_FAILURE; } diff --git a/editor/libeditor/text/nsInternetCiter.cpp b/editor/libeditor/text/nsInternetCiter.cpp index a71c045f713..4cd658aa343 100644 --- a/editor/libeditor/text/nsInternetCiter.cpp +++ b/editor/libeditor/text/nsInternetCiter.cpp @@ -171,20 +171,8 @@ nsInternetCiter::Rewrap(const nsAString& aInString, uint32_t citeLevel = 0; const nsPromiseFlatString &tString = PromiseFlatString(aInString); length = tString.Length(); -#ifdef DEBUG_wrapping - int loopcount = 0; -#endif while (posInString < length) { -#ifdef DEBUG_wrapping - printf("Outer loop: '%s'\n", - NS_LossyConvertUTF16toASCII(Substring(tString, posInString, - length-posInString)).get()); - printf("out string is now: '%s'\n", - NS_LossyConvertUTF16toASCII(aOutString).get()); - -#endif - // Get the new cite level here since we're at the beginning of a line uint32_t newCiteLevel = 0; while (posInString < length && tString[posInString] == gt) @@ -265,15 +253,6 @@ nsInternetCiter::Rewrap(const nsAString& aInString, // over this line of the input string to get all of it: while ((int32_t)posInString < nextNewline) { -#ifdef DEBUG_wrapping - if (++loopcount > 1000) - NS_ASSERTION(false, "possible infinite loop in nsInternetCiter\n"); - - printf("Inner loop: '%s'\n", - NS_LossyConvertUTF16toASCII(Substring(tString, posInString, - nextNewline-posInString)).get()); -#endif - // Skip over initial spaces: while ((int32_t)posInString < nextNewline && nsCRT::IsAsciiSpace(tString[posInString])) @@ -341,9 +320,6 @@ nsInternetCiter::Rewrap(const nsAString& aInString, // breaker. Just break the line, hard. if (NS_FAILED(rv)) { -#ifdef DEBUG_akkana - printf("nsInternetCiter: LineBreaker not working -- breaking hard\n"); -#endif breakPt = eol; } @@ -380,17 +356,8 @@ nsInternetCiter::Rewrap(const nsAString& aInString, BreakLine(aOutString, outStringCol, citeLevel); } // end inner loop within one line of aInString -#ifdef DEBUG_wrapping - printf("---------\nEnd inner loop: out string is now '%s'\n-----------\n", - NS_LossyConvertUTF16toASCII(aOutString).get()); -#endif } // end outer loop over lines of aInString -#ifdef DEBUG_wrapping - printf("Final out string is now: '%s'\n", - NS_LossyConvertUTF16toASCII(aOutString).get()); - -#endif return NS_OK; } diff --git a/editor/libeditor/text/nsPlaintextEditor.cpp b/editor/libeditor/text/nsPlaintextEditor.cpp index 1180501aecf..ed113b55532 100644 --- a/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/editor/libeditor/text/nsPlaintextEditor.cpp @@ -1363,14 +1363,9 @@ nsPlaintextEditor::PasteAsQuotation(int32_t aSelectionType) &len); if (NS_FAILED(rv) || !flav) { -#ifdef DEBUG_akkana - printf("PasteAsPlaintextQuotation: GetAnyTransferData failed, %d\n", rv); -#endif return rv; } -#ifdef DEBUG_clipboard - printf("Got flavor [%s]\n", flav); -#endif + if (0 == nsCRT::strcmp(flav, kUnicodeMime) || 0 == nsCRT::strcmp(flav, kMozTextInternal)) { @@ -1479,10 +1474,6 @@ nsPlaintextEditor::Rewrap(bool aRespectNewlines) if (wrapCol <= 0) wrapCol = 72; -#ifdef DEBUG_akkana - printf("nsPlaintextEditor::Rewrap to %ld columns\n", (long)wrapCol); -#endif - nsAutoString current; bool isCollapsed; rv = SharedOutputString(nsIDocumentEncoder::OutputFormatted @@ -1505,10 +1496,6 @@ nsPlaintextEditor::Rewrap(bool aRespectNewlines) NS_IMETHODIMP nsPlaintextEditor::StripCites() { -#ifdef DEBUG_akkana - printf("nsPlaintextEditor::StripCites()\n"); -#endif - nsAutoString current; bool isCollapsed; nsresult rv = SharedOutputString(nsIDocumentEncoder::OutputFormatted, diff --git a/editor/txtsvc/nsTextServicesDocument.cpp b/editor/txtsvc/nsTextServicesDocument.cpp index d3dcd52834f..25c1a3675d2 100644 --- a/editor/txtsvc/nsTextServicesDocument.cpp +++ b/editor/txtsvc/nsTextServicesDocument.cpp @@ -3711,44 +3711,6 @@ nsTextServicesDocument::FindWordBounds(nsTArray *aOffsetTable, return NS_OK; } -#ifdef DEBUG_kin -void -nsTextServicesDocument::PrintOffsetTable() -{ - OffsetEntry *entry; - uint32_t i; - - for (i = 0; i < mOffsetTable.Length(); i++) - { - entry = mOffsetTable[i]; - printf("ENTRY %4d: %p %c %c %4d %4d %4d\n", - i, entry->mNode, entry->mIsValid ? 'V' : 'N', - entry->mIsInsertedText ? 'I' : 'B', - entry->mNodeOffset, entry->mStrOffset, entry->mLength); - } - - fflush(stdout); -} - -void -nsTextServicesDocument::PrintContentNode(nsIContent *aContent) -{ - nsString tmpStr, str; - - aContent->Tag()->ToString(tmpStr); - printf("%s", NS_LossyConvertUTF16toASCII(tmpStr).get()); - - if (nsIDOMNode::TEXT_NODE == aContent->NodeType()) - { - aContent->AppendTextTo(str); - printf(": \"%s\"", NS_LossyConvertUTF16toASCII(str).get()); - } - - printf("\n"); - fflush(stdout); -} -#endif - NS_IMETHODIMP nsTextServicesDocument::WillInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, diff --git a/editor/txtsvc/nsTextServicesDocument.h b/editor/txtsvc/nsTextServicesDocument.h index 882c2873928..383e2b5ca30 100644 --- a/editor/txtsvc/nsTextServicesDocument.h +++ b/editor/txtsvc/nsTextServicesDocument.h @@ -224,11 +224,6 @@ private: int32_t *aWordStartOffset, nsIDOMNode **aWordEndNode, int32_t *aWordEndOffset); - -#ifdef DEBUG_kin - void PrintOffsetTable(); - void PrintContentNode(nsIContent *aContent); -#endif }; #endif // nsTextServicesDocument_h__ From 8700b4d494c6934b2ec012bf9e19054bf52901a7 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 7 Aug 2014 21:52:05 -0700 Subject: [PATCH 050/100] Bug 1049257 - Fix typo in CrashManager.addCrash() in order to update the crash date of existing items. r=gps --- toolkit/components/crashes/CrashManager.jsm | 2 +- .../crashes/tests/xpcshell/test_crash_manager.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/toolkit/components/crashes/CrashManager.jsm b/toolkit/components/crashes/CrashManager.jsm index 393fde11771..69837f79aa3 100644 --- a/toolkit/components/crashes/CrashManager.jsm +++ b/toolkit/components/crashes/CrashManager.jsm @@ -957,7 +957,7 @@ CrashStore.prototype = Object.freeze({ let crash = this._data.crashes.get(id); crash.type = type; - crash.date = date; + crash.crashDate = date; return crash; }, diff --git a/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js b/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js index bbf7de2c9dd..53596d6ca15 100644 --- a/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js +++ b/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js @@ -15,6 +15,9 @@ Cu.import("resource://testing-common/CrashManagerTest.jsm", this); const DUMMY_DATE = new Date(Date.now() - 10 * 24 * 60 * 60 * 1000); DUMMY_DATE.setMilliseconds(0); +const DUMMY_DATE_2 = new Date(Date.now() - 20 * 24 * 60 * 60 * 1000); +DUMMY_DATE_2.setMilliseconds(0); + function run_test() { do_get_profile(); configureLogging(); @@ -265,8 +268,13 @@ add_task(function* test_addCrash() { yield m.addCrash(m.PROCESS_TYPE_PLUGIN, m.CRASH_TYPE_HANG, "plugin-hang", DUMMY_DATE); + yield m.addCrash(m.PROCESS_TYPE_MAIN, m.CRASH_TYPE_CRASH, + "changing-item", DUMMY_DATE); + yield m.addCrash(m.PROCESS_TYPE_CONTENT, m.CRASH_TYPE_HANG, + "changing-item", DUMMY_DATE_2); + crashes = yield m.getCrashes(); - Assert.equal(crashes.length, 6); + Assert.equal(crashes.length, 7); let map = new Map(crashes.map(crash => [crash.id, crash])); @@ -305,6 +313,12 @@ add_task(function* test_addCrash() { Assert.equal(crash.crashDate, DUMMY_DATE); Assert.equal(crash.type, m.PROCESS_TYPE_PLUGIN + "-" + m.CRASH_TYPE_HANG); Assert.ok(crash.isOfType(m.PROCESS_TYPE_PLUGIN, m.CRASH_TYPE_HANG)); + + crash = map.get("changing-item"); + Assert.ok(!!crash); + Assert.equal(crash.crashDate, DUMMY_DATE_2); + Assert.equal(crash.type, m.PROCESS_TYPE_CONTENT + "-" + m.CRASH_TYPE_HANG); + Assert.ok(crash.isOfType(m.PROCESS_TYPE_CONTENT, m.CRASH_TYPE_HANG)); }); add_task(function* test_addSubmission() { From 8b1582446924218c65c75022c27ed2d87b57bd34 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 7 Aug 2014 21:52:05 -0700 Subject: [PATCH 051/100] Bug 994708 - Part 3: Record submission event for content crashes. r=gps --- browser/modules/TabCrashReporter.jsm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/browser/modules/TabCrashReporter.jsm b/browser/modules/TabCrashReporter.jsm index 3e8449b1089..d46f7e175d8 100644 --- a/browser/modules/TabCrashReporter.jsm +++ b/browser/modules/TabCrashReporter.jsm @@ -58,7 +58,8 @@ this.TabCrashReporter = { if (!dumpID) return - if (CrashSubmit.submit(dumpID)) { + let contentProcessType = Services.crashmanager.PROCESS_TYPE_CONTENT; + if (CrashSubmit.submit(dumpID, { processType: contentProcessType })) { this.childMap.set(childID, null); // Avoid resubmission. } }, From f6e1fa1acb134a85f9499cbaf4304234ee994e8f Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 7 Aug 2014 21:52:05 -0700 Subject: [PATCH 052/100] Bug 1048989 - Fix 'useless expression' warnings with MERGED_COMPONENT. r=gps --- services/common/bagheeraclient.js | 4 ++-- services/datareporting/policy.jsm | 4 ++-- services/datareporting/sessions.jsm | 4 ++-- services/healthreport/healthreporter.jsm | 4 ++-- services/healthreport/profile.jsm | 4 ++-- services/healthreport/providers.jsm | 4 ++-- services/metrics/Metrics.jsm | 4 ++-- services/metrics/dataprovider.jsm | 4 ++-- services/metrics/providermanager.jsm | 2 +- services/metrics/storage.jsm | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/services/common/bagheeraclient.js b/services/common/bagheeraclient.js index dcf3ca02b86..6ffb466c28e 100644 --- a/services/common/bagheeraclient.js +++ b/services/common/bagheeraclient.js @@ -9,10 +9,10 @@ * https://github.com/mozilla-metrics/bagheera */ -"use strict"; - #ifndef MERGED_COMPARTMENT +"use strict"; + this.EXPORTED_SYMBOLS = [ "BagheeraClient", "BagheeraClientRequestResult", diff --git a/services/datareporting/policy.jsm b/services/datareporting/policy.jsm index 758cfb1dc82..714e0c6a997 100644 --- a/services/datareporting/policy.jsm +++ b/services/datareporting/policy.jsm @@ -13,10 +13,10 @@ * eventually be split into its own type and module. */ -"use strict"; - #ifndef MERGED_COMPARTMENT +"use strict"; + this.EXPORTED_SYMBOLS = [ "DataSubmissionRequest", // For test use only. "DataReportingPolicy", diff --git a/services/datareporting/sessions.jsm b/services/datareporting/sessions.jsm index f393b339dbd..d741c8e66ae 100644 --- a/services/datareporting/sessions.jsm +++ b/services/datareporting/sessions.jsm @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; - #ifndef MERGED_COMPARTMENT +"use strict"; + this.EXPORTED_SYMBOLS = [ "SessionRecorder", ]; diff --git a/services/healthreport/healthreporter.jsm b/services/healthreport/healthreporter.jsm index e7ebf93bc3d..3bf342fc5cc 100644 --- a/services/healthreport/healthreporter.jsm +++ b/services/healthreport/healthreporter.jsm @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; - #ifndef MERGED_COMPARTMENT +"use strict"; + this.EXPORTED_SYMBOLS = ["HealthReporter"]; const {classes: Cc, interfaces: Ci, utils: Cu} = Components; diff --git a/services/healthreport/profile.jsm b/services/healthreport/profile.jsm index 07ab4d298f3..5f75e8b83fa 100644 --- a/services/healthreport/profile.jsm +++ b/services/healthreport/profile.jsm @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; - #ifndef MERGED_COMPARTMENT +"use strict"; + this.EXPORTED_SYMBOLS = [ "ProfileCreationTimeAccessor", "ProfileMetadataProvider", diff --git a/services/healthreport/providers.jsm b/services/healthreport/providers.jsm index 858d0f237db..047f3c00afa 100644 --- a/services/healthreport/providers.jsm +++ b/services/healthreport/providers.jsm @@ -12,10 +12,10 @@ * up. */ -"use strict"; - #ifndef MERGED_COMPARTMENT +"use strict"; + this.EXPORTED_SYMBOLS = [ "AddonsProvider", "AppInfoProvider", diff --git a/services/metrics/Metrics.jsm b/services/metrics/Metrics.jsm index 0b247e53daa..e1049d46873 100644 --- a/services/metrics/Metrics.jsm +++ b/services/metrics/Metrics.jsm @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; - #ifndef MERGED_COMPARTMENT +"use strict"; + this.EXPORTED_SYMBOLS = ["Metrics"]; const {classes: Cc, interfaces: Ci, utils: Cu} = Components; diff --git a/services/metrics/dataprovider.jsm b/services/metrics/dataprovider.jsm index ae662e94897..9b8a8466f14 100644 --- a/services/metrics/dataprovider.jsm +++ b/services/metrics/dataprovider.jsm @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; - #ifndef MERGED_COMPARTMENT +"use strict"; + this.EXPORTED_SYMBOLS = [ "Measurement", "Provider", diff --git a/services/metrics/providermanager.jsm b/services/metrics/providermanager.jsm index 0d50cd7d3ba..6f09662d3cb 100644 --- a/services/metrics/providermanager.jsm +++ b/services/metrics/providermanager.jsm @@ -2,9 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifndef MERGED_COMPARTMENT "use strict"; -#ifndef MERGED_COMPARTMENT this.EXPORTED_SYMBOLS = ["ProviderManager"]; const {classes: Cc, interfaces: Ci, utils: Cu} = Components; diff --git a/services/metrics/storage.jsm b/services/metrics/storage.jsm index 4f649513528..f4660aaeedb 100644 --- a/services/metrics/storage.jsm +++ b/services/metrics/storage.jsm @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; - #ifndef MERGED_COMPARTMENT +"use strict"; + this.EXPORTED_SYMBOLS = [ "DailyValues", "MetricsStorageBackend", From 29ca6cd16fc549ee622d376807472209b6711b61 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Thu, 7 Aug 2014 22:07:15 -0700 Subject: [PATCH 053/100] Bug 1050412 part 1: Use nsFrameList::Enumerator in nsSimplePageSequenceFrame to iterate over child frames. r=tn --- layout/generic/nsSimplePageSequenceFrame.cpp | 22 ++++++++------------ 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/layout/generic/nsSimplePageSequenceFrame.cpp b/layout/generic/nsSimplePageSequenceFrame.cpp index 5fb154e044b..d70c612eb2d 100644 --- a/layout/generic/nsSimplePageSequenceFrame.cpp +++ b/layout/generic/nsSimplePageSequenceFrame.cpp @@ -201,7 +201,8 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext, // Tile the pages vertically nsHTMLReflowMetrics kidSize(aReflowState); - for (nsIFrame* kidFrame = mFrames.FirstChild(); nullptr != kidFrame; ) { + for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) { + nsIFrame* kidFrame = e.get(); // Set the shared data into the page frame before reflow nsPageFrame * pf = static_cast(kidFrame); pf->SetSharedPageData(mPageData); @@ -244,22 +245,17 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext, // Add it to our child list mFrames.InsertFrame(nullptr, kidFrame, continuingPage); } - - // Get the next page - kidFrame = kidFrame->GetNextSibling(); } // Get Total Page Count - nsIFrame* page; - int32_t pageTot = 0; - for (page = mFrames.FirstChild(); page; page = page->GetNextSibling()) { - pageTot++; - } + // XXXdholbert technically we could calculate this in the loop above, + // instead of needing a separate walk. + int32_t pageTot = mFrames.GetLength(); // Set Page Number Info int32_t pageNum = 1; - for (page = mFrames.FirstChild(); page; page = page->GetNextSibling()) { - nsPageFrame * pf = static_cast(page); + for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) { + nsPageFrame * pf = static_cast(e.get()); if (pf != nullptr) { pf->SetPageNumInfo(pageNum, pageTot); } @@ -421,8 +417,8 @@ nsSimplePageSequenceFrame::StartPrint(nsPresContext* aPresContext, int32_t pageNum = 1; nscoord y = 0;//mMargin.top; - for (nsIFrame* page = mFrames.FirstChild(); page; - page = page->GetNextSibling()) { + for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) { + nsIFrame* page = e.get(); if (pageNum >= mFromPageNum && pageNum <= mToPageNum) { nsRect rect = page->GetRect(); rect.y = y; From af15d13ba4f2747a7a6f6fd4f0d51b4b2b8e2d2c Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Thu, 7 Aug 2014 22:07:16 -0700 Subject: [PATCH 054/100] Bug 1050412 part 2: Assert about frame type before static_casting, and drop useless null-check. r=tn --- layout/generic/nsSimplePageSequenceFrame.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/layout/generic/nsSimplePageSequenceFrame.cpp b/layout/generic/nsSimplePageSequenceFrame.cpp index d70c612eb2d..822fd7d35cd 100644 --- a/layout/generic/nsSimplePageSequenceFrame.cpp +++ b/layout/generic/nsSimplePageSequenceFrame.cpp @@ -255,10 +255,11 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext, // Set Page Number Info int32_t pageNum = 1; for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) { - nsPageFrame * pf = static_cast(e.get()); - if (pf != nullptr) { - pf->SetPageNumInfo(pageNum, pageTot); - } + MOZ_ASSERT(e.get()->GetType() == nsGkAtoms::pageFrame, + "only expecting nsPageFrame children. Other children will make " + "this static_cast bogus & probably violate other assumptions"); + nsPageFrame* pf = static_cast(e.get()); + pf->SetPageNumInfo(pageNum, pageTot); pageNum++; } From af47e5c0c1b471fa8eeaa3c05870ab3c77af7a75 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Thu, 7 Aug 2014 22:11:47 -0700 Subject: [PATCH 055/100] Bug 1032922 part 1: Give "flex-basis" its own keyword table, instead of having it co-opt kWidthKTable. r=heycam --- layout/style/nsCSSParser.cpp | 4 +- layout/style/nsCSSPropList.h | 2 +- layout/style/nsCSSProps.cpp | 8 ++ layout/style/nsCSSProps.h | 1 + layout/style/nsComputedDOMStyle.cpp | 2 +- layout/style/test/mochitest.ini | 1 + .../test/test_flexbox_flex_basis_values.html | 83 +++++++++++++++++++ 7 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 layout/style/test/test_flexbox_flex_basis_values.html diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 5ba794eba69..c922623a4d4 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -7451,7 +7451,7 @@ CSSParserImpl::ParseFlex() // "a unitless zero that is not already preceded by two flex factors must be // interpreted as a flex factor. if (!ParseNonNegativeVariant(tmpVal, flexBasisVariantMask | VARIANT_NUMBER, - nsCSSProps::kWidthKTable)) { + nsCSSProps::kFlexBasisKTable)) { // First component was not a valid flex-basis or flex-grow value. Fail. return false; } @@ -7499,7 +7499,7 @@ CSSParserImpl::ParseFlex() // unitless 0 encountered here *must* have been preceded by 2 flex factors. if (!wasFirstComponentFlexBasis && ParseNonNegativeVariant(tmpVal, flexBasisVariantMask, - nsCSSProps::kWidthKTable)) { + nsCSSProps::kFlexBasisKTable)) { flexBasis = tmpVal; } } diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index fd48ab5c171..54786eeb8fd 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -1657,7 +1657,7 @@ CSS_PROP_POSITION( // its own code to parse each subproperty. It does not depend on the // longhand parsing defined here. VARIANT_AHKLP | VARIANT_CALC, - kWidthKTable, + kFlexBasisKTable, offsetof(nsStylePosition, mFlexBasis), eStyleAnimType_Coord) CSS_PROP_POSITION( diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 64277080c8a..68b9cb2ffba 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -1125,6 +1125,14 @@ const KTableValue nsCSSProps::kAlignSelfKTable[] = { eCSSKeyword_UNKNOWN,-1 }; +const KTableValue nsCSSProps::kFlexBasisKTable[] = { + eCSSKeyword__moz_max_content, NS_STYLE_WIDTH_MAX_CONTENT, + eCSSKeyword__moz_min_content, NS_STYLE_WIDTH_MIN_CONTENT, + eCSSKeyword__moz_fit_content, NS_STYLE_WIDTH_FIT_CONTENT, + eCSSKeyword__moz_available, NS_STYLE_WIDTH_AVAILABLE, + eCSSKeyword_UNKNOWN,-1 +}; + const KTableValue nsCSSProps::kFlexDirectionKTable[] = { eCSSKeyword_row, NS_STYLE_FLEX_DIRECTION_ROW, eCSSKeyword_row_reverse, NS_STYLE_FLEX_DIRECTION_ROW_REVERSE, diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index 79387a7e31f..e2f423af3ef 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -566,6 +566,7 @@ public: static const KTableValue kAlignContentKTable[]; static const KTableValue kAlignItemsKTable[]; static const KTableValue kAlignSelfKTable[]; + static const KTableValue kFlexBasisKTable[]; static const KTableValue kFlexDirectionKTable[]; static const KTableValue kFlexWrapKTable[]; static const KTableValue kJustifyContentKTable[]; diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 45f795fe371..cfdd62b95a9 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -3649,7 +3649,7 @@ nsComputedDOMStyle::DoGetFlexBasis() // } SetValueToCoord(val, StylePosition()->mFlexBasis, true, - nullptr, nsCSSProps::kWidthKTable); + nullptr, nsCSSProps::kFlexBasisKTable); return val; } diff --git a/layout/style/test/mochitest.ini b/layout/style/test/mochitest.ini index 15e495e8cad..ef8880799db 100644 --- a/layout/style/test/mochitest.ini +++ b/layout/style/test/mochitest.ini @@ -124,6 +124,7 @@ skip-if = toolkit == 'android' #bug 536603 [test_extra_inherit_initial.html] [test_flexbox_align_self_auto.html] [test_flexbox_child_display_values.xhtml] +[test_flexbox_flex_basis_values.html] [test_flexbox_flex_grow_and_shrink.html] [test_flexbox_flex_shorthand.html] [test_flexbox_layout.html] diff --git a/layout/style/test/test_flexbox_flex_basis_values.html b/layout/style/test/test_flexbox_flex_basis_values.html new file mode 100644 index 00000000000..aa9613d6ffe --- /dev/null +++ b/layout/style/test/test_flexbox_flex_basis_values.html @@ -0,0 +1,83 @@ + + + + + + + Test that 'flex-basis' accepts all valid values for 'width' and 'height' + (helper for Bug 1032922) + + + + + + +

+ +
+
+
+ + From 4625d2bc21ab594af21ae7a4468ca439c9b47eb3 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Thu, 7 Aug 2014 22:11:48 -0700 Subject: [PATCH 056/100] Bug 1032922 part 2: Rename flex-basis's "auto" keyword to "main-size" (but retain "flex:auto" as shorthand for "1 1 main-size"). r=heycam --- browser/base/content/browser.css | 4 +-- browser/devtools/markupview/markup-view.css | 2 +- browser/metro/theme/config.css | 10 +++---- .../customizableui/panelUIOverlay.inc.css | 2 +- .../themes/shared/devtools/webconsole.inc.css | 24 +++++++-------- layout/base/nsLayoutUtils.cpp | 22 ++++---------- layout/generic/nsFlexContainerFrame.cpp | 14 +++++---- layout/generic/nsFrame.cpp | 23 ++++---------- .../flexbox/flexbox-position-absolute-1.xhtml | 4 +-- .../flexbox/flexbox-position-absolute-2.xhtml | 4 +-- .../flexbox/flexbox-position-absolute-4.xhtml | 2 +- .../flexbox/flexbox-position-fixed-1.xhtml | 4 +-- .../flexbox/flexbox-position-fixed-2.xhtml | 4 +-- .../flexbox/flexbox-position-fixed-4.xhtml | 2 +- .../flexbox-basic-canvas-horiz-1.xhtml | 16 +++++----- .../flexbox/flexbox-basic-canvas-vert-1.xhtml | 16 +++++----- .../flexbox-basic-fieldset-horiz-1.xhtml | 16 +++++----- .../flexbox-basic-fieldset-vert-1.xhtml | 16 +++++----- .../flexbox-basic-iframe-horiz-1.xhtml | 16 +++++----- .../flexbox/flexbox-basic-iframe-vert-1.xhtml | 16 +++++----- .../flexbox/flexbox-basic-img-horiz-1.xhtml | 18 ++++++----- .../flexbox/flexbox-basic-img-vert-1.xhtml | 18 ++++++----- .../flexbox-basic-textarea-horiz-1.xhtml | 16 +++++----- .../flexbox-basic-textarea-vert-1.xhtml | 16 +++++----- .../flexbox/flexbox-basic-video-horiz-1.xhtml | 16 +++++----- .../flexbox/flexbox-basic-video-vert-1.xhtml | 16 +++++----- .../flexbox-collapsed-item-horiz-1-ref.html | 2 +- .../flexbox-collapsed-item-horiz-1.html | 2 +- layout/style/nsCSSKeywordList.h | 1 + layout/style/nsCSSParser.cpp | 14 +++++++-- layout/style/nsCSSProps.cpp | 1 + layout/style/nsRuleNode.cpp | 16 +++++++--- layout/style/nsStyleConsts.h | 6 ++++ layout/style/nsStyleStruct.cpp | 2 +- layout/style/nsStyleUtil.cpp | 23 ++++++++++++++ layout/style/nsStyleUtil.h | 17 +++++++++++ layout/style/test/flexbox_layout_testcases.js | 5 ++-- layout/style/test/property_database.js | 13 ++++++-- .../test/test_flexbox_flex_shorthand.html | 30 ++++++++++++++----- mobile/android/themes/core/aboutReader.css | 2 +- mobile/android/themes/core/config.css | 10 +++---- 41 files changed, 266 insertions(+), 195 deletions(-) diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index ea6569eec41..8e18e90c2f2 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -1046,14 +1046,14 @@ toolbarpaletteitem[dragover] { #customization-palette:not([hidden]) { display: block; - flex: 1 1 auto; + flex: 1 1 main-size; overflow: auto; min-height: 3em; } #customization-footer-spacer, #customization-spacer { - flex: 1 1 auto; + flex: 1 1 main-size; } #customization-footer { diff --git a/browser/devtools/markupview/markup-view.css b/browser/devtools/markupview/markup-view.css index f8db84abce6..a5d7dff360d 100644 --- a/browser/devtools/markupview/markup-view.css +++ b/browser/devtools/markupview/markup-view.css @@ -35,7 +35,7 @@ .html-editor-inner { border: solid .1px; - flex: 1 1 auto; + flex: 1 1 main-size; } .html-editor iframe { diff --git a/browser/metro/theme/config.css b/browser/metro/theme/config.css index 5a6f9e04893..65f9ba3a75f 100644 --- a/browser/metro/theme/config.css +++ b/browser/metro/theme/config.css @@ -57,7 +57,7 @@ body { min-width: 0; color: #000000; opacity: 1; - flex: 1 1 auto; + flex: 1 1 main-size; } #filter-input:-moz-placeholder { @@ -193,7 +193,7 @@ li { .pref-value { color: rgba(0,0,0,0.5); - flex: 1 1 auto; + flex: 1 1 main-size; border: none; -moz-appearance: none; background-image: none; @@ -227,7 +227,7 @@ li { } #new-pref-value-boolean { - flex: 1 1 auto; + flex: 1 1 main-size; } /* Disable newPref dialog spinbuttons, use custom version from Android */ @@ -239,7 +239,7 @@ li { #new-pref-container .pref-button.toggle { display: inline-block; opacity: 1; - flex: 0 1 auto; + flex: 0 1 main-size; float: right; } @@ -247,7 +247,7 @@ li { #new-pref-container .pref-button.create { display: inline-block; opacity: 1; - flex: 1 1 auto; + flex: 1 1 main-size; } .pref-item-line { diff --git a/browser/themes/shared/customizableui/panelUIOverlay.inc.css b/browser/themes/shared/customizableui/panelUIOverlay.inc.css index 829166b3236..1cb53284358 100644 --- a/browser/themes/shared/customizableui/panelUIOverlay.inc.css +++ b/browser/themes/shared/customizableui/panelUIOverlay.inc.css @@ -250,7 +250,7 @@ panelview:not([mainview]) .toolbarbutton-text, #PanelUI-contents { display: block; - flex: 1 0 auto; + flex: 1 0 main-size; margin-left: auto; margin-right: auto; padding: .5em 0; diff --git a/browser/themes/shared/devtools/webconsole.inc.css b/browser/themes/shared/devtools/webconsole.inc.css index f56ebbeba1b..aa49039dfd7 100644 --- a/browser/themes/shared/devtools/webconsole.inc.css +++ b/browser/themes/shared/devtools/webconsole.inc.css @@ -17,24 +17,24 @@ a { .message { display: flex; - flex: 0 0 auto; + flex: 0 0 main-size; padding: 0 7px; width: 100%; box-sizing: border-box; } .message > .timestamp { - flex: 0 0 auto; + flex: 0 0 main-size; color: GrayText; margin: 4px 6px 0 0; } .message > .indent { - flex: 0 0 auto; + flex: 0 0 main-size; } .message > .icon { - flex: 0 0 auto; + flex: 0 0 main-size; margin: 3px 6px 0 0; padding: 0 4px; height: 1em; @@ -66,7 +66,7 @@ a { /* The red bubble that shows the number of times a message is repeated */ .message-repeats { -moz-user-select: none; - flex: 0 0 auto; + flex: 0 0 main-size; margin: 2px 6px; padding: 0 6px; height: 1.25em; @@ -84,7 +84,7 @@ a { .message-location { display: flex; - flex: 0 0 auto; + flex: 0 0 main-size; align-self: flex-start; justify-content: flex-end; width: 10em; @@ -106,7 +106,7 @@ a { } .message-location > .line-number { - flex: 0 0 auto; + flex: 0 0 main-size; } .message-flex-body { @@ -120,7 +120,7 @@ a { .message-flex-body > .message-body { display: block; - flex: 1 1 auto; + flex: 1 1 main-size; vertical-align: middle; } @@ -236,11 +236,11 @@ a { } .message[category=network] .method { - flex: 0 0 auto; + flex: 0 0 main-size; } .message[category=network]:not(.navigation-marker) .url { - flex: 1 1 auto; + flex: 1 1 main-size; /* Make sure the URL is very small initially, let flex change width as needed. */ width: 100px; min-width: 5em; @@ -250,7 +250,7 @@ a { } .message[category=network] .status { - flex: 0 0 auto; + flex: 0 0 main-size; -moz-margin-start: 6px; } @@ -454,7 +454,7 @@ a { .stacktrace .function { display: block; - flex: 1 1 auto; + flex: 1 1 main-size; } .cm-s-mozilla a[class] { diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index da1a91abe62..850fa99d094 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -69,6 +69,7 @@ #include "SVGTextFrame.h" #include "nsStyleStructInlines.h" #include "nsStyleTransformMatrix.h" +#include "nsStyleUtil.h" #include "nsIFrameInlines.h" #include "ImageContainer.h" #include "nsComputedDOMStyle.h" @@ -4195,8 +4196,8 @@ nsLayoutUtils::ComputeSizeWithIntrinsicDimensions( if (isFlexItem) { // Flex items use their "flex-basis" property in place of their main-size // property (e.g. "width") for sizing purposes, *unless* they have - // "flex-basis:auto", in which case they use their main-size property after - // all. + // "flex-basis:main-size", in which case they use their main-size property + // after all. uint32_t flexDirection = aFrame->GetParent()->StylePosition()->mFlexDirection; isHorizontalFlexItem = @@ -4206,21 +4207,8 @@ nsLayoutUtils::ComputeSizeWithIntrinsicDimensions( // NOTE: The logic here should match the similar chunk for determining // widthStyleCoord and heightStyleCoord in nsFrame::ComputeSize(). const nsStyleCoord* flexBasis = &(stylePos->mFlexBasis); - if (flexBasis->GetUnit() != eStyleUnit_Auto) { - if (isHorizontalFlexItem) { - widthStyleCoord = flexBasis; - } else { - // One caveat for vertical flex items: We don't support enumerated - // values (e.g. "max-content") for height properties yet. So, if our - // computed flex-basis is an enumerated value, we'll just behave as if - // it were "auto", which means "use the main-size property after all" - // (which is "height", in this case). - // NOTE: Once we support intrinsic sizing keywords for "height", - // we should remove this check. - if (flexBasis->GetUnit() != eStyleUnit_Enumerated) { - heightStyleCoord = flexBasis; - } - } + if (!nsStyleUtil::IsFlexBasisMainSize(*flexBasis, isHorizontalFlexItem)) { + (isHorizontalFlexItem ? widthStyleCoord : heightStyleCoord) = flexBasis; } } diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index 270e98462a8..1bf2815649c 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -17,6 +17,7 @@ #include "nsPresContext.h" #include "nsRenderingContext.h" #include "nsStyleContext.h" +#include "nsStyleUtil.h" #include "prlog.h" #include #include "mozilla/LinkedList.h" @@ -571,7 +572,8 @@ protected: // These are non-const so that we can lazily update them with the item's // intrinsic size (obtained via a "measuring" reflow), when necessary. - // (e.g. for "flex-basis:auto;height:auto" & "min-height:auto") + // (e.g. if we have a vertical flex item with "flex-basis:auto", + // "flex-basis:main-size;height:auto", or "min-height:auto") nscoord mFlexBaseSize; nscoord mMainMinSize; nscoord mMainMaxSize; @@ -1166,10 +1168,10 @@ PartiallyResolveAutoMinSize(const FlexItem& aFlexItem, // from here, w/ std::min(). // We need the smallest of: - // * the used flex-basis, if the computed flex-basis was 'auto': - // XXXdholbert ('auto' might be renamed to 'main-size'; see bug 1032922) - if (eStyleUnit_Auto == - aItemReflowState.mStylePosition->mFlexBasis.GetUnit() && + // * the used flex-basis, if the computed flex-basis was 'main-size': + const nsStyleCoord& flexBasis = aItemReflowState.mStylePosition->mFlexBasis; + const bool isHorizontal = IsAxisHorizontal(aAxisTracker.GetMainAxis()); + if (nsStyleUtil::IsFlexBasisMainSize(flexBasis, isHorizontal) && aFlexItem.GetFlexBaseSize() != NS_AUTOHEIGHT) { // NOTE: We skip this if the flex base size depends on content & isn't yet // resolved. This is OK, because the caller is responsible for computing @@ -1223,7 +1225,7 @@ ResolveAutoFlexBasisFromRatio(FlexItem& aFlexItem, "Should only be called to resolve an 'auto' flex-basis"); // If the flex item has ... // - an intrinsic aspect ratio, - // - a [used] flex-basis of 'main-size' [auto?] [We have this, if we're here.] + // - a [used] flex-basis of 'main-size' [We have this, if we're here.] // - a definite cross size // then the flex base size is calculated from its inner cross size and the // flex item’s intrinsic aspect ratio. diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 1a01ddbdbb3..18938f23fc0 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -26,6 +26,7 @@ #include "nsIScrollableFrame.h" #include "nsPresContext.h" #include "nsStyleConsts.h" +#include "nsStyleUtil.h" #include "nsIPresShell.h" #include "prlog.h" #include "prprf.h" @@ -4060,8 +4061,8 @@ nsFrame::ComputeSize(nsRenderingContext *aRenderingContext, if (isFlexItem) { // Flex items use their "flex-basis" property in place of their main-size // property (e.g. "width") for sizing purposes, *unless* they have - // "flex-basis:auto", in which case they use their main-size property after - // all. + // "flex-basis:main-size", in which case they use their main-size property + // after all. uint32_t flexDirection = GetParent()->StylePosition()->mFlexDirection; isHorizontalFlexItem = flexDirection == NS_STYLE_FLEX_DIRECTION_ROW || @@ -4071,21 +4072,9 @@ nsFrame::ComputeSize(nsRenderingContext *aRenderingContext, // widthStyleCoord and heightStyleCoord in // nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(). const nsStyleCoord* flexBasis = &(stylePos->mFlexBasis); - if (flexBasis->GetUnit() != eStyleUnit_Auto) { - if (isHorizontalFlexItem) { - widthStyleCoord = flexBasis; - } else { - // One caveat for vertical flex items: We don't support enumerated - // values (e.g. "max-content") for height properties yet. So, if our - // computed flex-basis is an enumerated value, we'll just behave as if - // it were "auto", which means "use the main-size property after all" - // (which is "height", in this case). - // NOTE: Once we support intrinsic sizing keywords for "height", - // we should remove this check. - if (flexBasis->GetUnit() != eStyleUnit_Enumerated) { - heightStyleCoord = flexBasis; - } - } + if (!nsStyleUtil::IsFlexBasisMainSize(*flexBasis, isHorizontalFlexItem)) { + (isHorizontalFlexItem ? + widthStyleCoord : heightStyleCoord) = flexBasis; } } diff --git a/layout/reftests/flexbox/flexbox-position-absolute-1.xhtml b/layout/reftests/flexbox/flexbox-position-absolute-1.xhtml index aa89dd714c2..f00a88efea2 100644 --- a/layout/reftests/flexbox/flexbox-position-absolute-1.xhtml +++ b/layout/reftests/flexbox/flexbox-position-absolute-1.xhtml @@ -28,13 +28,13 @@ display: flex; } div.a { - flex: 1 0 auto; + flex: 1 0 main-size; width: 30px; height: 100px; background: lightgreen; } div.b { - flex: 2 0 auto; + flex: 2 0 main-size; width: 20px; height: 100px; background: yellow; diff --git a/layout/reftests/flexbox/flexbox-position-absolute-2.xhtml b/layout/reftests/flexbox/flexbox-position-absolute-2.xhtml index d676272c037..4fecea94d8a 100644 --- a/layout/reftests/flexbox/flexbox-position-absolute-2.xhtml +++ b/layout/reftests/flexbox/flexbox-position-absolute-2.xhtml @@ -29,13 +29,13 @@ display: flex; } div.a { - flex: 1 0 auto; + flex: 1 0 main-size; width: 30px; height: 100px; background: lightgreen; } div.b { - flex: 2 0 auto; + flex: 2 0 main-size; width: 20px; height: 100px; background: yellow; diff --git a/layout/reftests/flexbox/flexbox-position-absolute-4.xhtml b/layout/reftests/flexbox/flexbox-position-absolute-4.xhtml index 67974fcf67a..7218599c2bd 100644 --- a/layout/reftests/flexbox/flexbox-position-absolute-4.xhtml +++ b/layout/reftests/flexbox/flexbox-position-absolute-4.xhtml @@ -32,7 +32,7 @@ border: 1px solid black; } div.a { - flex: 1 0 auto; + flex: 1 0 main-size; width: 30px; height: 100px; background: lightgreen; diff --git a/layout/reftests/flexbox/flexbox-position-fixed-1.xhtml b/layout/reftests/flexbox/flexbox-position-fixed-1.xhtml index 6401fb2cb19..e0e8a1e995e 100644 --- a/layout/reftests/flexbox/flexbox-position-fixed-1.xhtml +++ b/layout/reftests/flexbox/flexbox-position-fixed-1.xhtml @@ -28,13 +28,13 @@ display: flex; } div.a { - flex: 1 0 auto; + flex: 1 0 main-size; width: 30px; height: 100px; background: lightgreen; } div.b { - flex: 2 0 auto; + flex: 2 0 main-size; width: 20px; height: 100px; background: yellow; diff --git a/layout/reftests/flexbox/flexbox-position-fixed-2.xhtml b/layout/reftests/flexbox/flexbox-position-fixed-2.xhtml index c4f02bc9ce4..94753951840 100644 --- a/layout/reftests/flexbox/flexbox-position-fixed-2.xhtml +++ b/layout/reftests/flexbox/flexbox-position-fixed-2.xhtml @@ -29,13 +29,13 @@ display: flex; } div.a { - flex: 1 0 auto; + flex: 1 0 main-size; width: 30px; height: 100px; background: lightgreen; } div.b { - flex: 2 0 auto; + flex: 2 0 main-size; width: 20px; height: 100px; background: yellow; diff --git a/layout/reftests/flexbox/flexbox-position-fixed-4.xhtml b/layout/reftests/flexbox/flexbox-position-fixed-4.xhtml index 05c75baeeb4..d01a0bb117c 100644 --- a/layout/reftests/flexbox/flexbox-position-fixed-4.xhtml +++ b/layout/reftests/flexbox/flexbox-position-fixed-4.xhtml @@ -32,7 +32,7 @@ border: 2px dashed teal; } div.a { - flex: 1 0 auto; + flex: 1 0 main-size; width: 30px; height: 100px; background: lightgreen; diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-horiz-1.xhtml b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-horiz-1.xhtml index 60f5faed660..70c2c70d78a 100644 --- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-horiz-1.xhtml +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-horiz-1.xhtml @@ -62,8 +62,8 @@ 1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px -->
- - + +
- - + +
- - + +
- - + +
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-vert-1.xhtml b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-vert-1.xhtml index 6bc088c906e..8c3ac123b31 100644 --- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-vert-1.xhtml +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-vert-1.xhtml @@ -64,8 +64,8 @@ 1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px -->
- - + +
- - + +
- - + +
- - + +
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-horiz-1.xhtml b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-horiz-1.xhtml index 50ef7baa8d9..d277c1aa5b4 100644 --- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-horiz-1.xhtml +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-horiz-1.xhtml @@ -66,8 +66,8 @@ 1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px -->
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-vert-1.xhtml b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-vert-1.xhtml index b032af5512f..c8b110b88a6 100644 --- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-vert-1.xhtml +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-vert-1.xhtml @@ -68,8 +68,8 @@ 1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px -->
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-iframe-horiz-1.xhtml b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-iframe-horiz-1.xhtml index 4019bcaae99..9804f5e1f55 100644 --- a/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-iframe-horiz-1.xhtml +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-iframe-horiz-1.xhtml @@ -63,8 +63,8 @@ 1st element gets 3/5 of space: 13px + 3/5 * 150px = 103px -->
-