From 6c05aa2a3691bc6bbf7d6534762efc9ebbbff467 Mon Sep 17 00:00:00 2001 From: Maja Frydrychowicz Date: Tue, 22 Mar 2016 18:53:57 -0400 Subject: [PATCH 01/93] Bug 1261412 - Report when mach python-test collects no tests; r=gps MozReview-Commit-ID: GDlshUUjO7C --HG-- extra : rebase_source : 21c028d6e77b4ee6eeb9e0040d1d6ea19f79d7f8 --- python/mach_commands.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/python/mach_commands.py b/python/mach_commands.py index b8dbb10ebcd6..e52d9f41044a 100644 --- a/python/mach_commands.py +++ b/python/mach_commands.py @@ -79,7 +79,8 @@ class MachCommands(MachCommandBase): help='Stop running tests after the first error or failure.') @CommandArgument('tests', nargs='*', metavar='TEST', - help='Tests to run. Each test can be a single file or a directory.') + help=('Tests to run. Each test can be a single file or a directory. ' + 'Tests must be part of PYTHON_UNIT_TESTS.')) def python_test(self, tests=[], test_objects=None, @@ -94,6 +95,7 @@ class MachCommands(MachCommandBase): # launching Python multiple times. This also runs tests via mozunit, # which produces output in the format Mozilla infrastructure expects. return_code = 0 + found_tests = False if test_objects is None: # If we're not being called from `mach test`, do our own # test resolution. @@ -108,6 +110,7 @@ class MachCommands(MachCommandBase): test_objects = resolver.resolve_tests(flavor='python') for test in test_objects: + found_tests = True f = test['path'] file_displayed_test = [] # Used as a boolean. @@ -138,6 +141,13 @@ class MachCommands(MachCommandBase): if stop and return_code > 0: return 1 + if not found_tests: + self.log(logging.WARN, 'python-test', {}, + 'TEST-UNEXPECTED-FAIL | No tests collected ' + '(not in PYTHON_UNIT_TESTS?)') + + return 1 + return 0 if return_code == 0 else 1 @Command('eslint', category='devenv', From 50c8a09f370801902dc60a650a74625054fc242b Mon Sep 17 00:00:00 2001 From: Maja Frydrychowicz Date: Thu, 14 Apr 2016 13:06:47 -0400 Subject: [PATCH 02/93] Bug 1261412 - Relax test output requirement in mach python-test; r=gps This accounts for default unittest and pytest output formatting, in addition to mozunit. MozReview-Commit-ID: 749CD0xQezX --HG-- extra : rebase_source : 7a451c61d1ec41303b859b8fff4ec3dd2f84064c --- python/mach_commands.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/mach_commands.py b/python/mach_commands.py index e52d9f41044a..735a207bfc93 100644 --- a/python/mach_commands.py +++ b/python/mach_commands.py @@ -115,8 +115,11 @@ class MachCommands(MachCommandBase): file_displayed_test = [] # Used as a boolean. def _line_handler(line): - if not file_displayed_test and line.startswith('TEST-'): - file_displayed_test.append(True) + if not file_displayed_test: + output = ('Ran' in line or 'collected' in line or + line.startswith('TEST-')) + if output: + file_displayed_test.append(True) inner_return_code = self.run_process( [self.virtualenv_manager.python_path, f], From 0c371cb3e0060830977f9b2511cb1ff9c67e2a2c Mon Sep 17 00:00:00 2001 From: Maja Frydrychowicz Date: Mon, 18 Apr 2016 10:21:56 -0400 Subject: [PATCH 03/93] Bug 1261412 - Add mach python-test option to collect tests based on path alone; r=gps MozReview-Commit-ID: 4rsG6sMPqpv --HG-- extra : rebase_source : 4ef7599a8d6b60a6a81baf62564eebd92df7a585 --- python/mach_commands.py | 67 ++++++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 15 deletions(-) diff --git a/python/mach_commands.py b/python/mach_commands.py index 735a207bfc93..daf6abe75c8a 100644 --- a/python/mach_commands.py +++ b/python/mach_commands.py @@ -68,7 +68,7 @@ class MachCommands(MachCommandBase): append_env={b'PYTHONDONTWRITEBYTECODE': str('1')}) @Command('python-test', category='testing', - description='Run Python unit tests.') + description='Run Python unit tests with an appropriate test runner.') @CommandArgument('--verbose', default=False, action='store_true', @@ -77,37 +77,74 @@ class MachCommands(MachCommandBase): default=False, action='store_true', help='Stop running tests after the first error or failure.') + @CommandArgument('--path-only', + default=False, + action='store_true', + help=('Collect all tests under given path instead of default ' + 'test resolution. Supports pytest-style tests.')) @CommandArgument('tests', nargs='*', metavar='TEST', help=('Tests to run. Each test can be a single file or a directory. ' - 'Tests must be part of PYTHON_UNIT_TESTS.')) + 'Default test resolution relies on PYTHON_UNIT_TESTS.')) def python_test(self, tests=[], test_objects=None, subsuite=None, verbose=False, + path_only=False, stop=False): self._activate_virtualenv() + def find_tests_by_path(): + import glob + files = [] + for t in tests: + if t.endswith('.py') and os.path.isfile(t): + files.append(t) + elif os.path.isdir(t): + for root, _, _ in os.walk(t): + files += glob.glob(mozpath.join(root, 'test*.py')) + files += glob.glob(mozpath.join(root, 'unit*.py')) + else: + self.log(logging.WARN, 'python-test', + {'test': t}, + 'TEST-UNEXPECTED-FAIL | Invalid test: {test}') + if stop: + break + return files + # Python's unittest, and in particular discover, has problems with # clashing namespaces when importing multiple test modules. What follows # is a simple way to keep environments separate, at the price of - # launching Python multiple times. This also runs tests via mozunit, + # launching Python multiple times. Most tests are run via mozunit, # which produces output in the format Mozilla infrastructure expects. + # Some tests are run via pytest, and these should be equipped with a + # local mozunit_report plugin to meet output expectations. return_code = 0 found_tests = False if test_objects is None: # If we're not being called from `mach test`, do our own # test resolution. - from mozbuild.testing import TestResolver - resolver = self._spawn(TestResolver) - if tests: - # If we were given test paths, try to find tests matching them. - test_objects = resolver.resolve_tests(paths=tests, - flavor='python') + if path_only: + if tests: + self.virtualenv_manager.install_pip_package( + 'pytest==2.9.1' + ) + test_objects = [{'path': p} for p in find_tests_by_path()] + else: + self.log(logging.WARN, 'python-test', {}, + 'TEST-UNEXPECTED-FAIL | No tests specified') + test_objects = [] else: - # Otherwise just run all Python tests. - test_objects = resolver.resolve_tests(flavor='python') + from mozbuild.testing import TestResolver + resolver = self._spawn(TestResolver) + if tests: + # If we were given test paths, try to find tests matching them. + test_objects = resolver.resolve_tests(paths=tests, + flavor='python') + else: + # Otherwise just run everything in PYTHON_UNIT_TESTS + test_objects = resolver.resolve_tests(flavor='python') for test in test_objects: found_tests = True @@ -145,10 +182,10 @@ class MachCommands(MachCommandBase): return 1 if not found_tests: - self.log(logging.WARN, 'python-test', {}, - 'TEST-UNEXPECTED-FAIL | No tests collected ' - '(not in PYTHON_UNIT_TESTS?)') - + message = 'TEST-UNEXPECTED-FAIL | No tests collected' + if not path_only: + message += ' (Not in PYTHON_UNIT_TESTS? Try --path-only?)' + self.log(logging.WARN, 'python-test', {}, message) return 1 return 0 if return_code == 0 else 1 From df7216ecb41e77de84f31cf24e5bc86089fe48bc Mon Sep 17 00:00:00 2001 From: "Nils Ohlmeier [:drno]" Date: Tue, 5 Apr 2016 17:10:03 -0700 Subject: [PATCH 04/93] Bug 1259842: allow RFC1918 pairing again r=mjf MozReview-Commit-ID: 6afbRF64PM2 --HG-- extra : rebase_source : fbdf8db55ed9fb22cf39b375551741a5e75aac14 --- media/mtransport/test/ice_unittest.cpp | 4 +++- media/mtransport/third_party/nICEr/src/ice/ice_component.c | 7 +------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/media/mtransport/test/ice_unittest.cpp b/media/mtransport/test/ice_unittest.cpp index 657dc575cea1..15495ace4b7b 100644 --- a/media/mtransport/test/ice_unittest.cpp +++ b/media/mtransport/test/ice_unittest.cpp @@ -3294,7 +3294,9 @@ TEST_F(WebRtcIceConnectTest, TestPollCandPairsAfterConnect) { ASSERT_TRUE(ContainsSucceededPair(pairs)); } -TEST_F(WebRtcIceConnectTest, TestHostCandPairingFilter) { +// TODO Bug 1259842 - disabled until we find a better way to handle two +// candidates from different RFC1918 ranges +TEST_F(WebRtcIceConnectTest, DISABLED_TestHostCandPairingFilter) { Init(false, false, false, false); AddStream("first", 1); ASSERT_TRUE(Gather()); diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_component.c b/media/mtransport/third_party/nICEr/src/ice/ice_component.c index 6cf407506fea..5555e28ec32e 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_component.c +++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.c @@ -991,8 +991,7 @@ int nr_ice_component_can_candidate_tcptype_pair(nr_socket_tcp_type left, nr_sock return(1); } -/* local vs. remote matters here because we allow private -> public pairing, - * but discourage public -> private pairing. */ +/* filter out pairings which won't work. */ int nr_ice_component_can_candidate_addr_pair(nr_transport_addr *local, nr_transport_addr *remote) { int remote_range; @@ -1007,10 +1006,6 @@ int nr_ice_component_can_candidate_addr_pair(nr_transport_addr *local, nr_transp if(nr_transport_addr_is_loopback(local) != nr_transport_addr_is_loopback(remote)) return(0); - remote_range = nr_transport_addr_get_private_addr_range(remote); - if(remote_range && (nr_transport_addr_get_private_addr_range(local) != - remote_range)) - return(0); return(1); } From c63ec8cd08728c5fdf1421ec82e163e6bdba477e Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Sun, 17 Apr 2016 04:29:53 -0700 Subject: [PATCH 05/93] Bug 1263307 P1 Make ServiceWorkerRegistrationInfo::mScope const. r=jdm --- dom/workers/ServiceWorkerRegistrationInfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/workers/ServiceWorkerRegistrationInfo.h b/dom/workers/ServiceWorkerRegistrationInfo.h index 169af898d400..257288fbbfd4 100644 --- a/dom/workers/ServiceWorkerRegistrationInfo.h +++ b/dom/workers/ServiceWorkerRegistrationInfo.h @@ -33,7 +33,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSISERVICEWORKERREGISTRATIONINFO - nsCString mScope; + const nsCString mScope; nsCOMPtr mPrincipal; From a9a4f7363cf4a7e5907f009249e5af4cbbd2f3e8 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Sun, 17 Apr 2016 04:29:53 -0700 Subject: [PATCH 06/93] Bug 1263307 P2 Make ServiceWorkerRegistrationInfo worker members private. r=jdm --- dom/notification/Notification.cpp | 4 +- dom/workers/ServiceWorkerManager.cpp | 66 +++++++++---------- dom/workers/ServiceWorkerRegistrationInfo.cpp | 42 ++++++++++++ dom/workers/ServiceWorkerRegistrationInfo.h | 26 ++++++-- dom/workers/ServiceWorkerUpdateJob.cpp | 34 +++++----- 5 files changed, 117 insertions(+), 55 deletions(-) diff --git a/dom/notification/Notification.cpp b/dom/notification/Notification.cpp index 6454fd4dad48..044fdb903d2a 100644 --- a/dom/notification/Notification.cpp +++ b/dom/notification/Notification.cpp @@ -2575,8 +2575,8 @@ public: // This is coming from a ServiceWorkerRegistrationWorkerThread. MOZ_ASSERT(registration); - if (!registration->mActiveWorker || - registration->mActiveWorker->ID() != mWorkerPrivate->ServiceWorkerID()) { + if (!registration->GetActive() || + registration->GetActive()->ID() != mWorkerPrivate->ServiceWorkerID()) { mRv = NS_ERROR_NOT_AVAILABLE; } diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp index 4eb787914d40..1d136ee4dadd 100644 --- a/dom/workers/ServiceWorkerManager.cpp +++ b/dom/workers/ServiceWorkerManager.cpp @@ -182,9 +182,9 @@ PopulateRegistrationData(nsIPrincipal* aPrincipal, return NS_ERROR_FAILURE; } - if (aRegistration->mActiveWorker) { - aData.currentWorkerURL() = aRegistration->mActiveWorker->ScriptSpec(); - aData.cacheName() = aRegistration->mActiveWorker->CacheName(); + if (aRegistration->GetActive()) { + aData.currentWorkerURL() = aRegistration->GetActive()->ScriptSpec(); + aData.cacheName() = aRegistration->GetActive()->CacheName(); } return NS_OK; @@ -1181,7 +1181,7 @@ ServiceWorkerManager::CheckReadyPromise(nsPIDOMWindowInner* aWindow, RefPtr registration = GetServiceWorkerRegistrationInfo(principal, aURI); - if (registration && registration->mActiveWorker) { + if (registration && registration->GetActive()) { NS_ConvertUTF8toUTF16 scope(registration->mScope); RefPtr swr = aWindow->GetServiceWorkerRegistration(scope); @@ -1211,7 +1211,7 @@ ServiceWorkerManager::GetActiveWorkerInfoForScope(const PrincipalOriginAttribute return nullptr; } - return registration->mActiveWorker; + return registration->GetActive(); } ServiceWorkerInfo* @@ -1226,7 +1226,7 @@ ServiceWorkerManager::GetActiveWorkerInfoForDocument(nsIDocument* aDocument) return nullptr; } - return registration->mActiveWorker; + return registration->GetActive(); } namespace { @@ -1601,8 +1601,8 @@ ServiceWorkerManager::LoadRegistration( } else { // If active worker script matches our expectations for a "current worker", // then we are done. - if (registration->mActiveWorker && - registration->mActiveWorker->ScriptSpec() == aRegistration.currentWorkerURL()) { + if (registration->GetActive() && + registration->GetActive()->ScriptSpec() == aRegistration.currentWorkerURL()) { // No needs for updates. return; } @@ -1610,10 +1610,10 @@ ServiceWorkerManager::LoadRegistration( const nsCString& currentWorkerURL = aRegistration.currentWorkerURL(); if (!currentWorkerURL.IsEmpty()) { - registration->mActiveWorker = + registration->SetActive( new ServiceWorkerInfo(registration->mPrincipal, registration->mScope, - currentWorkerURL, aRegistration.cacheName()); - registration->mActiveWorker->SetActivateStateUncheckedWithoutEvent(ServiceWorkerState::Activated); + currentWorkerURL, aRegistration.cacheName())); + registration->GetActive()->SetActivateStateUncheckedWithoutEvent(ServiceWorkerState::Activated); } } @@ -2023,9 +2023,9 @@ ServiceWorkerManager::StopControllingADocument(ServiceWorkerRegistrationInfo* aR } else { // If the registration has an active worker that is running // this might be a good time to stop it. - if (aRegistration->mActiveWorker) { + if (aRegistration->GetActive()) { ServiceWorkerPrivate* serviceWorkerPrivate = - aRegistration->mActiveWorker->WorkerPrivate(); + aRegistration->GetActive()->WorkerPrivate(); serviceWorkerPrivate->NoteStoppedControllingDocuments(); } aRegistration->TryToActivateAsync(); @@ -2158,11 +2158,11 @@ ServiceWorkerManager::GetServiceWorkerForScope(nsPIDOMWindowInner* aWindow, RefPtr info; if (aWhichWorker == WhichServiceWorker::INSTALLING_WORKER) { - info = registration->mInstallingWorker; + info = registration->GetInstalling(); } else if (aWhichWorker == WhichServiceWorker::WAITING_WORKER) { - info = registration->mWaitingWorker; + info = registration->GetWaiting(); } else if (aWhichWorker == WhichServiceWorker::ACTIVE_WORKER) { - info = registration->mActiveWorker; + info = registration->GetActive(); } else { MOZ_CRASH("Invalid worker type"); } @@ -2301,8 +2301,8 @@ ServiceWorkerManager::DispatchFetchEvent(const PrincipalOriginAttributes& aOrigi } // This should only happen if IsAvailable() returned true. - MOZ_ASSERT(registration->mActiveWorker); - serviceWorker = registration->mActiveWorker; + MOZ_ASSERT(registration->GetActive()); + serviceWorker = registration->GetActive(); AddNavigationInterception(serviceWorker->Scope(), aChannel); } @@ -2343,7 +2343,7 @@ ServiceWorkerManager::IsAvailable(nsIPrincipal* aPrincipal, RefPtr registration = GetServiceWorkerRegistrationInfo(aPrincipal, aURI); - return registration && registration->mActiveWorker; + return registration && registration->GetActive(); } bool @@ -2378,7 +2378,7 @@ ServiceWorkerManager::GetDocumentRegistration(nsIDocument* aDoc, } // If the document is controlled, the current worker MUST be non-null. - if (!registration->mActiveWorker) { + if (!registration->GetActive()) { return NS_ERROR_NOT_AVAILABLE; } @@ -2406,9 +2406,9 @@ ServiceWorkerManager::GetDocumentController(nsPIDOMWindowInner* aWindow, return rv; } - MOZ_ASSERT(registration->mActiveWorker); + MOZ_ASSERT(registration->GetActive()); RefPtr serviceWorker = - registration->mActiveWorker->GetOrCreateInstance(aWindow); + registration->GetActive()->GetOrCreateInstance(aWindow); serviceWorker.forget(aServiceWorker); return NS_OK; @@ -2523,7 +2523,7 @@ ServiceWorkerManager::SoftUpdate(const PrincipalOriginAttributes& aOriginAttribu } // "If registration's installing worker is not null, abort these steps." - if (registration->mInstallingWorker) { + if (registration->GetInstalling()) { return; } @@ -2794,7 +2794,7 @@ ServiceWorkerManager::MaybeClaimClient(nsIDocument* aDocument, ServiceWorkerRegistrationInfo* aWorkerRegistration) { MOZ_ASSERT(aWorkerRegistration); - MOZ_ASSERT(aWorkerRegistration->mActiveWorker); + MOZ_ASSERT(aWorkerRegistration->GetActive()); // Same origin check if (!aWorkerRegistration->mPrincipal->Equals(aDocument->NodePrincipal())) { @@ -2829,8 +2829,8 @@ ServiceWorkerManager::ClaimClients(nsIPrincipal* aPrincipal, RefPtr registration = GetRegistration(aPrincipal, aScope); - if (!registration || !registration->mActiveWorker || - !(registration->mActiveWorker->ID() == aId)) { + if (!registration || !registration->GetActive() || + !(registration->GetActive()->ID() == aId)) { // The worker is not active. return NS_ERROR_DOM_INVALID_STATE_ERR; } @@ -2855,13 +2855,13 @@ ServiceWorkerManager::SetSkipWaitingFlag(nsIPrincipal* aPrincipal, return NS_ERROR_FAILURE; } - if (registration->mInstallingWorker && - (registration->mInstallingWorker->ID() == aServiceWorkerID)) { - registration->mInstallingWorker->SetSkipWaitingFlag(); - } else if (registration->mWaitingWorker && - (registration->mWaitingWorker->ID() == aServiceWorkerID)) { - registration->mWaitingWorker->SetSkipWaitingFlag(); - if (registration->mWaitingWorker->State() == ServiceWorkerState::Installed) { + if (registration->GetInstalling() && + (registration->GetInstalling()->ID() == aServiceWorkerID)) { + registration->GetInstalling()->SetSkipWaitingFlag(); + } else if (registration->GetWaiting() && + (registration->GetWaiting()->ID() == aServiceWorkerID)) { + registration->GetWaiting()->SetSkipWaitingFlag(); + if (registration->GetWaiting()->State() == ServiceWorkerState::Installed) { registration->TryToActivateAsync(); } } else { diff --git a/dom/workers/ServiceWorkerRegistrationInfo.cpp b/dom/workers/ServiceWorkerRegistrationInfo.cpp index 6c5496e52f6a..97f4518cfc08 100644 --- a/dom/workers/ServiceWorkerRegistrationInfo.cpp +++ b/dom/workers/ServiceWorkerRegistrationInfo.cpp @@ -367,4 +367,46 @@ ServiceWorkerRegistrationInfo::CheckAndClearIfUpdateNeeded() return result; } +ServiceWorkerInfo* +ServiceWorkerRegistrationInfo::GetInstalling() const +{ + AssertIsOnMainThread(); + return mInstallingWorker; +} + +ServiceWorkerInfo* +ServiceWorkerRegistrationInfo::GetWaiting() const +{ + AssertIsOnMainThread(); + return mWaitingWorker; +} + +ServiceWorkerInfo* +ServiceWorkerRegistrationInfo::GetActive() const +{ + AssertIsOnMainThread(); + return mActiveWorker; +} + +void +ServiceWorkerRegistrationInfo::SetInstalling(ServiceWorkerInfo* aServiceWorker) +{ + AssertIsOnMainThread(); + mInstallingWorker = aServiceWorker; +} + +void +ServiceWorkerRegistrationInfo::SetWaiting(ServiceWorkerInfo* aServiceWorker) +{ + AssertIsOnMainThread(); + mWaitingWorker = aServiceWorker; +} + +void +ServiceWorkerRegistrationInfo::SetActive(ServiceWorkerInfo* aServiceWorker) +{ + AssertIsOnMainThread(); + mActiveWorker = aServiceWorker; +} + END_WORKERS_NAMESPACE diff --git a/dom/workers/ServiceWorkerRegistrationInfo.h b/dom/workers/ServiceWorkerRegistrationInfo.h index 257288fbbfd4..5c3f93c6be05 100644 --- a/dom/workers/ServiceWorkerRegistrationInfo.h +++ b/dom/workers/ServiceWorkerRegistrationInfo.h @@ -27,6 +27,10 @@ class ServiceWorkerRegistrationInfo final uint64_t mLastUpdateCheckTime; + RefPtr mActiveWorker; + RefPtr mWaitingWorker; + RefPtr mInstallingWorker; + virtual ~ServiceWorkerRegistrationInfo(); public: @@ -37,10 +41,6 @@ public: nsCOMPtr mPrincipal; - RefPtr mActiveWorker; - RefPtr mWaitingWorker; - RefPtr mInstallingWorker; - nsTArray> mListeners; // When unregister() is called on a registration, it is not immediately @@ -123,6 +123,24 @@ public: bool CheckAndClearIfUpdateNeeded(); + + ServiceWorkerInfo* + GetInstalling() const; + + ServiceWorkerInfo* + GetWaiting() const; + + ServiceWorkerInfo* + GetActive() const; + + void + SetInstalling(ServiceWorkerInfo* aServiceWorker); + + void + SetWaiting(ServiceWorkerInfo* aServiceWorker); + + void + SetActive(ServiceWorkerInfo* aServiceWorker); }; } // namespace workers diff --git a/dom/workers/ServiceWorkerUpdateJob.cpp b/dom/workers/ServiceWorkerUpdateJob.cpp index 0444f5b9389d..f03230a4f780 100644 --- a/dom/workers/ServiceWorkerUpdateJob.cpp +++ b/dom/workers/ServiceWorkerUpdateJob.cpp @@ -152,11 +152,11 @@ ServiceWorkerUpdateJob::FailUpdateJob(ErrorResult& aRv) RefPtr swm = ServiceWorkerManager::GetInstance(); - if (mRegistration->mInstallingWorker) { - mRegistration->mInstallingWorker->UpdateState(ServiceWorkerState::Redundant); + if (mRegistration->GetInstalling()) { + mRegistration->GetInstalling()->UpdateState(ServiceWorkerState::Redundant); serviceWorkerScriptCache::PurgeCache(mRegistration->mPrincipal, - mRegistration->mInstallingWorker->CacheName()); - mRegistration->mInstallingWorker = nullptr; + mRegistration->GetInstalling()->CacheName()); + mRegistration->SetInstalling(nullptr); if (swm) { swm->InvalidateServiceWorkerRegistrationWorker(mRegistration, WhichServiceWorker::INSTALLING_WORKER); @@ -242,7 +242,7 @@ ServiceWorkerUpdateJob::Update() // SetRegistration() must be called before Update(). MOZ_ASSERT(mRegistration); - MOZ_ASSERT(!mRegistration->mInstallingWorker); + MOZ_ASSERT(!mRegistration->GetInstalling()); // Begin the script download and comparison steps starting at step 5 // of the Update algorithm. @@ -413,15 +413,16 @@ ServiceWorkerUpdateJob::Install() AssertIsOnMainThread(); MOZ_ASSERT(!Canceled()); - MOZ_ASSERT(!mRegistration->mInstallingWorker); + MOZ_ASSERT(!mRegistration->GetInstalling()); // Begin step 2 of the Install algorithm. // // https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#installation-algorithm MOZ_ASSERT(mServiceWorker); - mRegistration->mInstallingWorker = mServiceWorker.forget(); - mRegistration->mInstallingWorker->UpdateState(ServiceWorkerState::Installing); + mRegistration->SetInstalling(mServiceWorker); + mServiceWorker = nullptr; + mRegistration->GetInstalling()->UpdateState(ServiceWorkerState::Installing); mRegistration->NotifyListenersOnChange(); RefPtr swm = ServiceWorkerManager::GetInstance(); @@ -453,7 +454,7 @@ ServiceWorkerUpdateJob::Install() // Send the install event to the worker thread ServiceWorkerPrivate* workerPrivate = - mRegistration->mInstallingWorker->WorkerPrivate(); + mRegistration->GetInstalling()->WorkerPrivate(); nsresult rv = workerPrivate->SendLifeCycleEvent(NS_LITERAL_STRING("install"), callback, failRunnable); if (NS_WARN_IF(NS_FAILED(rv))) { @@ -468,7 +469,7 @@ ServiceWorkerUpdateJob::ContinueAfterInstallEvent(bool aInstallEventSuccess) return FailUpdateJob(NS_ERROR_DOM_ABORT_ERR); } - MOZ_ASSERT(mRegistration->mInstallingWorker); + MOZ_ASSERT(mRegistration->GetInstalling()); RefPtr swm = ServiceWorkerManager::GetInstance(); @@ -482,15 +483,16 @@ ServiceWorkerUpdateJob::ContinueAfterInstallEvent(bool aInstallEventSuccess) } // "If registration's waiting worker is not null" - if (mRegistration->mWaitingWorker) { - mRegistration->mWaitingWorker->WorkerPrivate()->TerminateWorker(); - mRegistration->mWaitingWorker->UpdateState(ServiceWorkerState::Redundant); + if (mRegistration->GetWaiting()) { + mRegistration->GetWaiting()->WorkerPrivate()->TerminateWorker(); + mRegistration->GetWaiting()->UpdateState(ServiceWorkerState::Redundant); serviceWorkerScriptCache::PurgeCache(mRegistration->mPrincipal, - mRegistration->mWaitingWorker->CacheName()); + mRegistration->GetWaiting()->CacheName()); } - mRegistration->mWaitingWorker = mRegistration->mInstallingWorker.forget(); - mRegistration->mWaitingWorker->UpdateState(ServiceWorkerState::Installed); + mRegistration->SetWaiting(mRegistration->GetInstalling()); + mRegistration->SetInstalling(nullptr); + mRegistration->GetWaiting()->UpdateState(ServiceWorkerState::Installed); mRegistration->NotifyListenersOnChange(); swm->StoreRegistration(mPrincipal, mRegistration); swm->InvalidateServiceWorkerRegistrationWorker(mRegistration, From b3e4dd4541e632a1d383eed5c649402055816904 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Sun, 17 Apr 2016 04:29:53 -0700 Subject: [PATCH 07/93] Bug 1263307 P3 Move ServiceWorker update logic into central place in ServiceWorkerRegistrationInfo methods. r=jdm --- dom/workers/ServiceWorkerInfo.cpp | 5 + dom/workers/ServiceWorkerRegistrationInfo.cpp | 146 +++++++++++------- dom/workers/ServiceWorkerRegistrationInfo.h | 27 +++- dom/workers/ServiceWorkerUpdateJob.cpp | 41 +---- 4 files changed, 124 insertions(+), 95 deletions(-) diff --git a/dom/workers/ServiceWorkerInfo.cpp b/dom/workers/ServiceWorkerInfo.cpp index 622989e5fc54..afa017e02e2a 100644 --- a/dom/workers/ServiceWorkerInfo.cpp +++ b/dom/workers/ServiceWorkerInfo.cpp @@ -6,6 +6,8 @@ #include "ServiceWorkerInfo.h" +#include "ServiceWorkerScriptCache.h" + BEGIN_WORKERS_NAMESPACE NS_IMPL_ISUPPORTS(ServiceWorkerInfo, nsIServiceWorkerInfo) @@ -139,6 +141,9 @@ ServiceWorkerInfo::UpdateState(ServiceWorkerState aState) mState = aState; nsCOMPtr r = new ChangeStateUpdater(mInstances, mState); MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r.forget())); + if (mState == ServiceWorkerState::Redundant) { + serviceWorkerScriptCache::PurgeCache(mPrincipal, mCacheName); + } } ServiceWorkerInfo::ServiceWorkerInfo(nsIPrincipal* aPrincipal, diff --git a/dom/workers/ServiceWorkerRegistrationInfo.cpp b/dom/workers/ServiceWorkerRegistrationInfo.cpp index 97f4518cfc08..256071751349 100644 --- a/dom/workers/ServiceWorkerRegistrationInfo.cpp +++ b/dom/workers/ServiceWorkerRegistrationInfo.cpp @@ -20,36 +20,19 @@ ServiceWorkerRegistrationInfo::Clear() if (mWaitingWorker) { mWaitingWorker->UpdateState(ServiceWorkerState::Redundant); - - nsresult rv = serviceWorkerScriptCache::PurgeCache(mPrincipal, - mWaitingWorker->CacheName()); - if (NS_FAILED(rv)) { - NS_WARNING("Failed to purge the waiting cache."); - } - mWaitingWorker->WorkerPrivate()->NoteDeadServiceWorkerInfo(); mWaitingWorker = nullptr; } if (mActiveWorker) { mActiveWorker->UpdateState(ServiceWorkerState::Redundant); - - nsresult rv = serviceWorkerScriptCache::PurgeCache(mPrincipal, - mActiveWorker->CacheName()); - if (NS_FAILED(rv)) { - NS_WARNING("Failed to purge the active cache."); - } - mActiveWorker->WorkerPrivate()->NoteDeadServiceWorkerInfo(); mActiveWorker = nullptr; } - RefPtr swm = ServiceWorkerManager::GetInstance(); - MOZ_ASSERT(swm); - swm->InvalidateServiceWorkerRegistrationWorker(this, - WhichServiceWorker::INSTALLING_WORKER | - WhichServiceWorker::WAITING_WORKER | - WhichServiceWorker::ACTIVE_WORKER); + NotifyListenersOnChange(WhichServiceWorker::INSTALLING_WORKER | + WhichServiceWorker::WAITING_WORKER | + WhichServiceWorker::ACTIVE_WORKER); } ServiceWorkerRegistrationInfo::ServiceWorkerRegistrationInfo(const nsACString& aScope, @@ -204,44 +187,18 @@ ServiceWorkerRegistrationInfo::TryToActivate() } } -void -ServiceWorkerRegistrationInfo::PurgeActiveWorker() -{ - RefPtr exitingWorker = mActiveWorker.forget(); - if (!exitingWorker) - return; - - // FIXME(jaoo): Bug 1170543 - Wait for exitingWorker to finish and terminate it. - exitingWorker->UpdateState(ServiceWorkerState::Redundant); - nsresult rv = serviceWorkerScriptCache::PurgeCache(mPrincipal, - exitingWorker->CacheName()); - if (NS_FAILED(rv)) { - NS_WARNING("Failed to purge the activating cache."); - } - RefPtr swm = ServiceWorkerManager::GetInstance(); - swm->InvalidateServiceWorkerRegistrationWorker(this, WhichServiceWorker::ACTIVE_WORKER); -} - void ServiceWorkerRegistrationInfo::Activate() { - RefPtr activatingWorker = mWaitingWorker; - if (!activatingWorker) { + if (!mWaitingWorker) { return; } - PurgeActiveWorker(); - - RefPtr swm = ServiceWorkerManager::GetInstance(); - swm->InvalidateServiceWorkerRegistrationWorker(this, WhichServiceWorker::WAITING_WORKER); - - mActiveWorker = activatingWorker.forget(); - mWaitingWorker = nullptr; - mActiveWorker->UpdateState(ServiceWorkerState::Activating); - NotifyListenersOnChange(); + TransitionWaitingToActive(); // FIXME(nsm): Unlink appcache if there is one. + RefPtr swm = ServiceWorkerManager::GetInstance(); swm->CheckPendingReadyPromises(); // "Queue a task to fire a simple event named controllerchange..." @@ -311,8 +268,16 @@ ServiceWorkerRegistrationInfo::IsLastUpdateCheckTimeOverOneDay() const } void -ServiceWorkerRegistrationInfo::NotifyListenersOnChange() +ServiceWorkerRegistrationInfo::NotifyListenersOnChange(WhichServiceWorker aChangedWorkers) { + AssertIsOnMainThread(); + MOZ_ASSERT(aChangedWorkers & (WhichServiceWorker::INSTALLING_WORKER | + WhichServiceWorker::WAITING_WORKER | + WhichServiceWorker::ACTIVE_WORKER)); + + RefPtr swm = ServiceWorkerManager::GetInstance(); + swm->InvalidateServiceWorkerRegistrationWorker(this, aChangedWorkers); + nsTArray> listeners(mListeners); for (size_t index = 0; index < listeners.Length(); ++index) { listeners[index]->OnChange(); @@ -389,24 +354,97 @@ ServiceWorkerRegistrationInfo::GetActive() const } void -ServiceWorkerRegistrationInfo::SetInstalling(ServiceWorkerInfo* aServiceWorker) +ServiceWorkerRegistrationInfo::ClearInstalling() { AssertIsOnMainThread(); - mInstallingWorker = aServiceWorker; + + if (!mInstallingWorker) { + return; + } + + mInstallingWorker->UpdateState(ServiceWorkerState::Redundant); + mInstallingWorker = nullptr; + NotifyListenersOnChange(WhichServiceWorker::INSTALLING_WORKER); } void -ServiceWorkerRegistrationInfo::SetWaiting(ServiceWorkerInfo* aServiceWorker) +ServiceWorkerRegistrationInfo::SetInstalling(ServiceWorkerInfo* aServiceWorker) { AssertIsOnMainThread(); - mWaitingWorker = aServiceWorker; + MOZ_ASSERT(aServiceWorker); + MOZ_ASSERT(!mInstallingWorker); + MOZ_ASSERT(mWaitingWorker != aServiceWorker); + MOZ_ASSERT(mActiveWorker != aServiceWorker); + + mInstallingWorker = aServiceWorker; + mInstallingWorker->UpdateState(ServiceWorkerState::Installing); + NotifyListenersOnChange(WhichServiceWorker::INSTALLING_WORKER); +} + +void +ServiceWorkerRegistrationInfo::TransitionInstallingToWaiting() +{ + AssertIsOnMainThread(); + MOZ_ASSERT(mInstallingWorker); + + if (mWaitingWorker) { + MOZ_ASSERT(mInstallingWorker->CacheName() != mWaitingWorker->CacheName()); + mWaitingWorker->UpdateState(ServiceWorkerState::Redundant); + } + + mWaitingWorker = mInstallingWorker.forget(); + mWaitingWorker->UpdateState(ServiceWorkerState::Installed); + NotifyListenersOnChange(WhichServiceWorker::INSTALLING_WORKER | + WhichServiceWorker::WAITING_WORKER); + + RefPtr swm = ServiceWorkerManager::GetInstance(); + swm->StoreRegistration(mPrincipal, this); } void ServiceWorkerRegistrationInfo::SetActive(ServiceWorkerInfo* aServiceWorker) { AssertIsOnMainThread(); + MOZ_ASSERT(aServiceWorker); + + // TODO: Assert installing, waiting, and active are nullptr once the SWM + // moves to the parent process. After that happens this code will + // only run for browser initialization and not for cross-process + // overrides. + MOZ_ASSERT(mInstallingWorker != aServiceWorker); + MOZ_ASSERT(mWaitingWorker != aServiceWorker); + MOZ_ASSERT(mActiveWorker != aServiceWorker); + + if (mActiveWorker) { + MOZ_ASSERT(aServiceWorker->CacheName() != mActiveWorker->CacheName()); + mActiveWorker->UpdateState(ServiceWorkerState::Redundant); + } + + // The active worker is being overriden due to initial load or + // another process activating a worker. Move straight to the + // Activated state. mActiveWorker = aServiceWorker; + mActiveWorker->SetActivateStateUncheckedWithoutEvent(ServiceWorkerState::Activated); + NotifyListenersOnChange(WhichServiceWorker::ACTIVE_WORKER); +} + +void +ServiceWorkerRegistrationInfo::TransitionWaitingToActive() +{ + AssertIsOnMainThread(); + MOZ_ASSERT(mWaitingWorker); + + if (mActiveWorker) { + MOZ_ASSERT(mWaitingWorker->CacheName() != mActiveWorker->CacheName()); + mActiveWorker->UpdateState(ServiceWorkerState::Redundant); + } + + // We are transitioning from waiting to active normally, so go to + // the activating state. + mActiveWorker = mWaitingWorker.forget(); + mActiveWorker->UpdateState(ServiceWorkerState::Activating); + NotifyListenersOnChange(WhichServiceWorker::WAITING_WORKER | + WhichServiceWorker::ACTIVE_WORKER); } END_WORKERS_NAMESPACE diff --git a/dom/workers/ServiceWorkerRegistrationInfo.h b/dom/workers/ServiceWorkerRegistrationInfo.h index 5c3f93c6be05..54ab52a72adb 100644 --- a/dom/workers/ServiceWorkerRegistrationInfo.h +++ b/dom/workers/ServiceWorkerRegistrationInfo.h @@ -91,9 +91,6 @@ public: void Clear(); - void - PurgeActiveWorker(); - void TryToActivateAsync(); @@ -113,7 +110,7 @@ public: IsLastUpdateCheckTimeOverOneDay() const; void - NotifyListenersOnChange(); + NotifyListenersOnChange(WhichServiceWorker aChangedWorkers); void MaybeScheduleTimeCheckAndUpdate(); @@ -133,14 +130,34 @@ public: ServiceWorkerInfo* GetActive() const; + // Remove an existing installing worker, if present. The worker will + // be transitioned to the Redundant state. + void + ClearInstalling(); + + // Set a new installing worker. This may only be called if there is no + // existing installing worker. The worker is transitioned to the Installing + // state. void SetInstalling(ServiceWorkerInfo* aServiceWorker); + // Transition the current installing worker to be the waiting worker. The + // workers state is updated to Installed. void - SetWaiting(ServiceWorkerInfo* aServiceWorker); + TransitionInstallingToWaiting(); + // Override the current active worker. This is used during browser + // initialization to load persisted workers. Its also used to propagate + // active workers across child processes in e10s. This second use will + // go away once the ServiceWorkerManager moves to the parent process. + // The worker is transitioned to the Activated state. void SetActive(ServiceWorkerInfo* aServiceWorker); + + // Transition the current waiting worker to be the new active worker. The + // worker is updated to the Activating state. + void + TransitionWaitingToActive(); }; } // namespace workers diff --git a/dom/workers/ServiceWorkerUpdateJob.cpp b/dom/workers/ServiceWorkerUpdateJob.cpp index f03230a4f780..22b7d85002da 100644 --- a/dom/workers/ServiceWorkerUpdateJob.cpp +++ b/dom/workers/ServiceWorkerUpdateJob.cpp @@ -150,19 +150,9 @@ ServiceWorkerUpdateJob::FailUpdateJob(ErrorResult& aRv) mServiceWorker->CacheName()); } + mRegistration->ClearInstalling(); + RefPtr swm = ServiceWorkerManager::GetInstance(); - - if (mRegistration->GetInstalling()) { - mRegistration->GetInstalling()->UpdateState(ServiceWorkerState::Redundant); - serviceWorkerScriptCache::PurgeCache(mRegistration->mPrincipal, - mRegistration->GetInstalling()->CacheName()); - mRegistration->SetInstalling(nullptr); - if (swm) { - swm->InvalidateServiceWorkerRegistrationWorker(mRegistration, - WhichServiceWorker::INSTALLING_WORKER); - } - } - if (swm) { swm->MaybeRemoveRegistration(mRegistration); } @@ -422,12 +412,6 @@ ServiceWorkerUpdateJob::Install() MOZ_ASSERT(mServiceWorker); mRegistration->SetInstalling(mServiceWorker); mServiceWorker = nullptr; - mRegistration->GetInstalling()->UpdateState(ServiceWorkerState::Installing); - mRegistration->NotifyListenersOnChange(); - - RefPtr swm = ServiceWorkerManager::GetInstance(); - swm->InvalidateServiceWorkerRegistrationWorker(mRegistration, - WhichServiceWorker::INSTALLING_WORKER); // Step 6 of the Install algorithm resolving the job promise. InvokeResultCallbacks(NS_OK); @@ -435,6 +419,8 @@ ServiceWorkerUpdateJob::Install() // The job promise cannot be rejected after this point, but the job can // still fail; e.g. if the install event handler throws, etc. + RefPtr swm = ServiceWorkerManager::GetInstance(); + // fire the updatefound event nsCOMPtr upr = NS_NewRunnableMethodWithArg>( @@ -471,8 +457,6 @@ ServiceWorkerUpdateJob::ContinueAfterInstallEvent(bool aInstallEventSuccess) MOZ_ASSERT(mRegistration->GetInstalling()); - RefPtr swm = ServiceWorkerManager::GetInstance(); - // Continue executing the Install algorithm at step 12. // "If installFailed is true" @@ -482,22 +466,7 @@ ServiceWorkerUpdateJob::ContinueAfterInstallEvent(bool aInstallEventSuccess) return; } - // "If registration's waiting worker is not null" - if (mRegistration->GetWaiting()) { - mRegistration->GetWaiting()->WorkerPrivate()->TerminateWorker(); - mRegistration->GetWaiting()->UpdateState(ServiceWorkerState::Redundant); - serviceWorkerScriptCache::PurgeCache(mRegistration->mPrincipal, - mRegistration->GetWaiting()->CacheName()); - } - - mRegistration->SetWaiting(mRegistration->GetInstalling()); - mRegistration->SetInstalling(nullptr); - mRegistration->GetWaiting()->UpdateState(ServiceWorkerState::Installed); - mRegistration->NotifyListenersOnChange(); - swm->StoreRegistration(mPrincipal, mRegistration); - swm->InvalidateServiceWorkerRegistrationWorker(mRegistration, - WhichServiceWorker::INSTALLING_WORKER | - WhichServiceWorker::WAITING_WORKER); + mRegistration->TransitionInstallingToWaiting(); Finish(NS_OK); From aa4de9b2d6f57f17c4a51363e758e3d90156ada7 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Tue, 29 Mar 2016 13:40:07 -0400 Subject: [PATCH 08/93] Bug 1236043 - Don't inflate empty rects. r=jrmuizel MozReview-Commit-ID: 1cpQhkugsFJ --HG-- extra : rebase_source : 037d3727d1ce03e6389b98b3a19f5b1c8536bba7 --- gfx/2d/Rect.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gfx/2d/Rect.h b/gfx/2d/Rect.h index 606aec1fa2a4..d9fb251017f6 100644 --- a/gfx/2d/Rect.h +++ b/gfx/2d/Rect.h @@ -123,6 +123,10 @@ struct IntRectTyped : void InflateToMultiple(const IntSizeTyped& aTileSize) { + if (this->IsEmpty()) { + return; + } + int32_t yMost = this->YMost(); int32_t xMost = this->XMost(); From 733dca91239848758542adf4489bb06172efe7f4 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 18 Apr 2016 13:48:58 -0400 Subject: [PATCH 09/93] Bug 1236043 - Add a TiledRegion class. r=jrmuizel MozReview-Commit-ID: Fb0kBGo3yYo --HG-- extra : rebase_source : 540035c7ac0598c55c433b25042997feb7da967b --- gfx/src/TiledRegion.cpp | 357 +++++++++++++++++++++++++++++++++ gfx/src/TiledRegion.h | 198 ++++++++++++++++++ gfx/src/moz.build | 5 + gfx/tests/gtest/TestRegion.cpp | 93 +++++++++ 4 files changed, 653 insertions(+) create mode 100644 gfx/src/TiledRegion.cpp create mode 100644 gfx/src/TiledRegion.h diff --git a/gfx/src/TiledRegion.cpp b/gfx/src/TiledRegion.cpp new file mode 100644 index 000000000000..fb14012fa7d3 --- /dev/null +++ b/gfx/src/TiledRegion.cpp @@ -0,0 +1,357 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#include "TiledRegion.h" + +#include + +#include "mozilla/fallible.h" + +namespace mozilla { +namespace gfx { + +static const int32_t kTileSize = 256; + +/** + * TiledRegionImpl stores an array of non-empty rectangles (pixman_box32_ts) to + * represent the region. Each rectangle is contained in a single tile; + * rectangles never cross tile boundaries. The rectangles are sorted by their + * tile's origin in top-to-bottom, left-to-right order. + * (Note that this can mean that a rectangle r1 can come before another + * rectangle r2 even if r2.y1 < r1.y1, as long as the two rects are in the same + * row of tiles and r1.x1 < r2.x1.) + * Empty tiles take up no space in the array - there is no rectangle stored for + * them. As a result, any algorithm that needs to deal with empty tiles will + * iterate through the mRects array and compare the positions of two + * consecutive rects to figure out whether there are any empty tiles between + * them. + */ + +static pixman_box32_t +IntersectionOfNonEmptyBoxes(const pixman_box32_t& aBox1, + const pixman_box32_t& aBox2) +{ + return pixman_box32_t { + std::max(aBox1.x1, aBox2.x1), + std::max(aBox1.y1, aBox2.y1), + std::min(aBox1.x2, aBox2.x2), + std::min(aBox1.y2, aBox2.y2) + }; +} + +// A TileIterator points to a specific tile inside a certain tile range, or to +// the end of the tile range. Advancing a TileIterator will move to the next +// tile inside the range (or to the range end). The next tile is either the +// tile to the right of the current one, or the first tile of the next tile +// row if the current tile is already the last tile in the row. +class TileIterator { +public: + TileIterator(const pixman_box32_t& aTileBounds, const IntPoint& aPosition) + : mTileBounds(aTileBounds) + , mPos(aPosition) + {} + + bool operator!=(const TileIterator& aOther) { return mPos != aOther.mPos; } + bool operator==(const TileIterator& aOther) { return mPos == aOther.mPos; } + + IntPoint operator*() const { return mPos; } + + const TileIterator& operator++() { + mPos.x += kTileSize; + if (mPos.x >= mTileBounds.x2) { + mPos.x = mTileBounds.x1; + mPos.y += kTileSize; + } + return *this; + } + + TileIterator& operator=(const IntPoint& aPosition) + { + mPos = aPosition; + return *this; + } + + bool IsBeforeTileContainingPoint(const IntPoint& aPoint) const + { + return (mPos.y + kTileSize) <= aPoint.y || + (mPos.y <= aPoint.y && (mPos.x + kTileSize) <= aPoint.x); + } + + bool IsAtTileContainingPoint(const IntPoint& aPoint) const + { + return mPos.y <= aPoint.y && aPoint.y < (mPos.y + kTileSize) && + mPos.x <= aPoint.x && aPoint.x < (mPos.x + kTileSize); + + } + + pixman_box32_t IntersectionWith(const pixman_box32_t& aRect) const + { + pixman_box32_t tile = { mPos.x, mPos.y, + mPos.x + kTileSize, mPos.y + kTileSize }; + return IntersectionOfNonEmptyBoxes(tile, aRect); + } + +private: + const pixman_box32_t& mTileBounds; + IntPoint mPos; +}; + +// A TileRange describes a range of tiles contained inside a certain tile +// bounds (which is a rectangle that includes all tiles that you're +// interested in). The tile range can start and end at any point inside a +// tile row. +// The tile range end is described by the tile that starts at the bottom +// left corner of the tile bounds, i.e. the first tile under the tile +// bounds. +class TileRange { +public: + // aTileBounds, aStart and aEnd need to be aligned with the tile grid. + TileRange(const pixman_box32_t& aTileBounds, + const IntPoint& aStart, const IntPoint& aEnd) + : mTileBounds(aTileBounds) + , mStart(aStart) + , mEnd(aEnd) + {} + // aTileBounds needs to be aligned with the tile grid. + explicit TileRange(const pixman_box32_t& aTileBounds) + : mTileBounds(aTileBounds) + , mStart(mTileBounds.x1, mTileBounds.y1) + , mEnd(mTileBounds.x1, mTileBounds.y2) + {} + + TileIterator Begin() const { return TileIterator(mTileBounds, mStart); } + TileIterator End() const { return TileIterator(mTileBounds, mEnd); } + + // The number of tiles in this tile range. + size_t Length() const + { + if (mEnd.y == mStart.y) { + return (mEnd.x - mStart.x) / kTileSize; + } + size_t numberOfFullRows = (mEnd.y - mStart.y) / kTileSize - 1; + return ((mTileBounds.x2 - mStart.x) + + (mTileBounds.x2 - mTileBounds.x1) * numberOfFullRows + + (mEnd.x - mTileBounds.x1)) / kTileSize; + } + + // If aTileOrigin does not describe a tile inside our tile bounds, move it + // to the next tile that you'd encounter by "advancing" a tile iterator + // inside these tile bounds. If aTileOrigin is after the last tile inside + // our tile bounds, move it to the range end tile. + // The result of this method is a valid end tile for a tile range with our + // tile bounds. + IntPoint MoveIntoBounds(const IntPoint& aTileOrigin) const + { + IntPoint p = aTileOrigin; + if (p.x < mTileBounds.x1) { + p.x = mTileBounds.x1; + } else if (p.x >= mTileBounds.x2) { + p.x = mTileBounds.x1; + p.y += kTileSize; + } + if (p.y < mTileBounds.y1) { + p.y = mTileBounds.y1; + p.x = mTileBounds.x1; + } else if (p.y >= mTileBounds.y2) { + // There's only one valid state after the end of the tile range, and that's + // the bottom left point of the tile bounds. + p.x = mTileBounds.x1; + p.y = mTileBounds.y2; + } + return p; + } + +private: + const pixman_box32_t& mTileBounds; + const IntPoint mStart; + const IntPoint mEnd; +}; + +static IntPoint +TileContainingPoint(const IntPoint& aPoint) +{ + return IntPoint(RoundDownToMultiple(aPoint.x, kTileSize), + RoundDownToMultiple(aPoint.y, kTileSize)); +} + +enum class IterationAction : uint8_t { + CONTINUE, + STOP +}; + +enum class IterationEndReason : uint8_t { + NOT_STOPPED, + STOPPED +}; + +template< + typename HandleEmptyTilesFunction, + typename HandleNonEmptyTileFunction, + typename RectArrayT> +IterationEndReason ProcessIntersectedTiles(const pixman_box32_t& aRect, + RectArrayT& aRectArray, + HandleEmptyTilesFunction aHandleEmptyTiles, + HandleNonEmptyTileFunction aHandleNonEmptyTile) +{ + pixman_box32_t tileBounds = { + RoundDownToMultiple(aRect.x1, kTileSize), + RoundDownToMultiple(aRect.y1, kTileSize), + RoundUpToMultiple(aRect.x2, kTileSize), + RoundUpToMultiple(aRect.y2, kTileSize) + }; + + TileRange tileRange(tileBounds); + TileIterator rangeEnd = tileRange.End(); + + // tileIterator points to the next tile in tileRange, or to rangeEnd if we're + // done. + TileIterator tileIterator = tileRange.Begin(); + + // We iterate over the rectangle array. Depending on the position of the + // rectangle we encounter, we may need to advance tileIterator by zero, one, + // or more tiles: + // - Zero if the rectangle we encountered is outside the tiles that + // intersect aRect. + // - One if the rectangle is in the exact tile that we're interested in next + // (i.e. the tile that tileIterator points at). + // - More than one if the encountered rectangle is in a tile that's further + // to the right or to the bottom than tileIterator. In that case there is + // at least one empty tile between the last rectangle we encountered and + // the current one. + for (size_t i = 0; i < aRectArray.Length() && tileIterator != rangeEnd; i++) { + MOZ_ASSERT(aRectArray[i].x1 < aRectArray[i].x2 && aRectArray[i].y1 < aRectArray[i].y2, "empty rect"); + IntPoint rectOrigin(aRectArray[i].x1, aRectArray[i].y1); + if (tileIterator.IsBeforeTileContainingPoint(rectOrigin)) { + IntPoint tileOrigin = TileContainingPoint(rectOrigin); + IntPoint afterEmptyTiles = tileRange.MoveIntoBounds(tileOrigin); + TileRange emptyTiles(tileBounds, *tileIterator, afterEmptyTiles); + if (aHandleEmptyTiles(aRectArray, i, emptyTiles) == IterationAction::STOP) { + return IterationEndReason::STOPPED; + } + tileIterator = afterEmptyTiles; + if (tileIterator == rangeEnd) { + return IterationEndReason::NOT_STOPPED; + } + } + if (tileIterator.IsAtTileContainingPoint(rectOrigin)) { + pixman_box32_t rectIntersection = tileIterator.IntersectionWith(aRect); + if (aHandleNonEmptyTile(aRectArray, i, rectIntersection) == IterationAction::STOP) { + return IterationEndReason::STOPPED; + } + ++tileIterator; + } + } + + if (tileIterator != rangeEnd) { + // We've looked at all of our existing rectangles but haven't covered all + // of the tiles that we're interested in yet. So we need to deal with the + // remaining tiles now. + size_t endIndex = aRectArray.Length(); + TileRange emptyTiles(tileBounds, *tileIterator, *rangeEnd); + if (aHandleEmptyTiles(aRectArray, endIndex, emptyTiles) == IterationAction::STOP) { + return IterationEndReason::STOPPED; + } + } + return IterationEndReason::NOT_STOPPED; +} + +static pixman_box32_t +UnionBoundsOfNonEmptyBoxes(const pixman_box32_t& aBox1, + const pixman_box32_t& aBox2) +{ + return { std::min(aBox1.x1, aBox2.x1), + std::min(aBox1.y1, aBox2.y1), + std::max(aBox1.x2, aBox2.x2), + std::max(aBox1.y2, aBox2.y2) }; +} + +// Returns true when adding the rectangle was successful, and false if +// allocation failed. +// When this returns false, our internal state might not be consistent and we +// need to be cleared. +bool +TiledRegionImpl::AddRect(const pixman_box32_t& aRect) +{ + // We are adding a rectangle that can span multiple tiles. + // For each empty tile that aRect intersects, we need to add the intersection + // of aRect with that tile to mRects, respecting the order of mRects. + // For each tile that already has a rectangle, we need to enlarge that + // existing rectangle to include the intersection of aRect with the tile. + return ProcessIntersectedTiles(aRect, mRects, + [&aRect](nsTArray& rects, size_t& rectIndex, TileRange emptyTiles) { + if (!rects.InsertElementsAt(rectIndex, emptyTiles.Length(), fallible)) { + return IterationAction::STOP; + } + for (TileIterator tileIt = emptyTiles.Begin(); + tileIt != emptyTiles.End(); + ++tileIt, ++rectIndex) { + rects[rectIndex] = tileIt.IntersectionWith(aRect); + } + return IterationAction::CONTINUE; + }, + [](nsTArray& rects, size_t rectIndex, const pixman_box32_t& rectIntersectionWithTile) { + rects[rectIndex] = + UnionBoundsOfNonEmptyBoxes(rects[rectIndex], rectIntersectionWithTile); + return IterationAction::CONTINUE; + }) == IterationEndReason::NOT_STOPPED; +} + +static bool +NonEmptyBoxesIntersect(const pixman_box32_t& aBox1, const pixman_box32_t& aBox2) +{ + return aBox1.x1 < aBox2.x2 && aBox2.x1 < aBox1.x2 && + aBox1.y1 < aBox2.y2 && aBox2.y1 < aBox1.y2; +} + +bool +TiledRegionImpl::Intersects(const pixman_box32_t& aRect) const +{ + // aRect intersects this region if it intersects any of our rectangles. + return ProcessIntersectedTiles(aRect, mRects, + [](const nsTArray& rects, size_t& rectIndex, TileRange emptyTiles) { + // Ignore empty tiles and keep on iterating. + return IterationAction::CONTINUE; + }, + [](const nsTArray& rects, size_t rectIndex, const pixman_box32_t& rectIntersectionWithTile) { + if (NonEmptyBoxesIntersect(rects[rectIndex], rectIntersectionWithTile)) { + // Found an intersecting rectangle, so aRect intersects this region. + return IterationAction::STOP; + } + return IterationAction::CONTINUE; + }) == IterationEndReason::STOPPED; +} + +static bool +NonEmptyBoxContainsNonEmptyBox(const pixman_box32_t& aBox1, const pixman_box32_t& aBox2) +{ + return aBox1.x1 <= aBox2.x1 && aBox2.x2 <= aBox1.x2 && + aBox1.y1 <= aBox2.y1 && aBox2.y2 <= aBox1.y2; +} + +bool +TiledRegionImpl::Contains(const pixman_box32_t& aRect) const +{ + // aRect is contained in this region if aRect does not intersect any empty + // tiles and, for each non-empty tile, if the intersection of aRect with that + // tile is contained in the existing rectangle we have in that tile. + return ProcessIntersectedTiles(aRect, mRects, + [](const nsTArray& rects, size_t& rectIndex, TileRange emptyTiles) { + // Found an empty tile that intersects aRect, so aRect is not contained + // in this region. + return IterationAction::STOP; + }, + [](const nsTArray& rects, size_t rectIndex, const pixman_box32_t& rectIntersectionWithTile) { + if (!NonEmptyBoxContainsNonEmptyBox(rects[rectIndex], rectIntersectionWithTile)) { + // Our existing rectangle in this tile does not cover the part of aRect that + // intersects this tile, so aRect is not contained in this region. + return IterationAction::STOP; + } + return IterationAction::CONTINUE; + }) == IterationEndReason::NOT_STOPPED; +} + +} // namespace gfx +} // namespace mozilla diff --git a/gfx/src/TiledRegion.h b/gfx/src/TiledRegion.h new file mode 100644 index 000000000000..10e884494463 --- /dev/null +++ b/gfx/src/TiledRegion.h @@ -0,0 +1,198 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef MOZILLA_GFX_TILEDREGION_H_ +#define MOZILLA_GFX_TILEDREGION_H_ + +#include "mozilla/ArrayView.h" +#include "mozilla/gfx/Rect.h" +#include "mozilla/Move.h" +#include "nsRegion.h" +#include "pixman.h" + +namespace mozilla { +namespace gfx { + +// See TiledRegion.cpp for documentation on TiledRegionImpl. +class TiledRegionImpl { +public: + void Clear() { mRects.Clear(); } + bool AddRect(const pixman_box32_t& aRect); + bool Intersects(const pixman_box32_t& aRect) const; + bool Contains(const pixman_box32_t& aRect) const; + operator ArrayView() const { return ArrayView(mRects); } + +private: + nsTArray mRects; +}; + +/** + * A auto-simplifying region type that supports one rectangle per tile. + * The virtual tile grid is anchored at (0, 0) and has quadratic tiles whose + * size is hard-coded as kTileSize in TiledRegion.cpp. + * A TiledRegion starts out empty. You can add rectangles or (regular) regions + * into it by calling Add(). Add() is a mutating union operation (similar to + * OrWith on nsRegion) that's *not* exact, because it will enlarge the region as + * necessary to satisfy the "one rectangle per tile" requirement. + * Tiled regions convert implicitly to the underlying regular region type. + * The only way to remove parts from a TiledRegion is by calling SetEmpty(). + */ +template +class TiledRegion { +public: + typedef typename RegionT::RectType RectT; + + TiledRegion() + : mCoversBounds(false) + {} + + TiledRegion(const TiledRegion& aOther) + : mBounds(aOther.mBounds) + , mImpl(aOther.mImpl) + , mCoversBounds(false) + {} + + TiledRegion(TiledRegion&& aOther) + : mBounds(aOther.mBounds) + , mImpl(Move(aOther.mImpl)) + , mCoversBounds(false) + {} + + RegionT GetRegion() const + { + if (mBounds.IsEmpty()) { + return RegionT(); + } + if (mCoversBounds) { + // Rect limit hit or allocation failed, treat as 1 rect. + return RegionT(mBounds); + } + return RegionT(mImpl); + } + + TiledRegion& operator=(const TiledRegion& aOther) + { + if (&aOther != this) { + mBounds = aOther.mBounds; + mImpl = aOther.mImpl; + mCoversBounds = aOther.mCoversBounds; + } + return *this; + } + + void Add(const RectT& aRect) + { + if (aRect.IsEmpty()) { + return; + } + + mBounds = mBounds.Union(aRect); + + if (mCoversBounds) { + return; + } + if (ExceedsMaximumSize()) { + FallBackToBounds(); + return; + } + + if (!mImpl.AddRect(RectToBox(aRect))) { + FallBackToBounds(); + } + } + + void Add(const RegionT& aRegion) + { + mBounds = mBounds.Union(aRegion.GetBounds()); + + if (mCoversBounds) { + return; + } + if (ExceedsMaximumSize()) { + FallBackToBounds(); + return; + } + + for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) { + RectT r = iter.Get(); + MOZ_ASSERT(!r.IsEmpty()); + if (!mImpl.AddRect(RectToBox(r))) { + FallBackToBounds(); + return; + } + } + } + + bool IsEmpty() const { return mBounds.IsEmpty(); } + + void SetEmpty() + { + mBounds.SetEmpty(); + mImpl.Clear(); + mCoversBounds = false; + } + + RectT GetBounds() const { return mBounds; } + + bool Intersects(const RectT& aRect) const + { + if (!mBounds.Intersects(aRect)) { + return false; + } + if (mCoversBounds) { + return true; + } + + return mImpl.Intersects(RectToBox(aRect)); + } + + bool Contains(const RectT& aRect) const + { + if (!mBounds.Contains(aRect)) { + return false; + } + if (mCoversBounds) { + return true; + } + return mImpl.Contains(RectToBox(aRect)); + } + +private: + + bool ExceedsMaximumSize() const + { + // This stops us from allocating insane numbers of tiles. + return mBounds.width >= 50 * 256 || mBounds.height >= 50 * 256; + } + + void FallBackToBounds() + { + mCoversBounds = true; + mImpl.Clear(); + } + + static pixman_box32_t RectToBox(const RectT& aRect) + { + return { aRect.x, aRect.y, aRect.XMost(), aRect.YMost() }; + } + + RectT mBounds; + TiledRegionImpl mImpl; + + // mCoversBounds is true if we bailed out due to a large number of tiles. + // mCoversBounds being true means that this TiledRegion is just a simple + // rectangle (our mBounds). + // Once set to true, the TiledRegion will stay in this state until SetEmpty + // is called. + bool mCoversBounds; +}; + +typedef TiledRegion TiledIntRegion; + +} // namespace gfx +} // namespace mozilla + +#endif /* MOZILLA_GFX_TILEDREGION_H_ */ diff --git a/gfx/src/moz.build b/gfx/src/moz.build index d78ef3e205eb..f9c89ca2408a 100644 --- a/gfx/src/moz.build +++ b/gfx/src/moz.build @@ -46,6 +46,10 @@ EXPORTS.mozilla += [ 'ArrayView.h', ] +EXPORTS.mozilla.gfx += [ + 'TiledRegion.h', +] + if CONFIG['MOZ_X11']: EXPORTS.mozilla += ['X11Util.h'] SOURCES += [ @@ -66,6 +70,7 @@ UNIFIED_SOURCES += [ 'nsThebesFontEnumerator.cpp', 'nsThebesGfxFactory.cpp', 'nsTransform2D.cpp', + 'TiledRegion.cpp', ] # nsDeviceContext.cpp cannot be built in unified mode because it pulls in OS X system headers. diff --git a/gfx/tests/gtest/TestRegion.cpp b/gfx/tests/gtest/TestRegion.cpp index 87099cecb163..9d39471be750 100644 --- a/gfx/tests/gtest/TestRegion.cpp +++ b/gfx/tests/gtest/TestRegion.cpp @@ -11,8 +11,10 @@ #include "nsRect.h" #include "nsRegion.h" #include "RegionBuilder.h" +#include "mozilla/gfx/TiledRegion.h" using namespace std; +using namespace mozilla::gfx; class TestLargestRegion { public: @@ -597,6 +599,97 @@ TEST(Gfx, PingPongRegion) { } } +// The TiledRegion tests use nsIntRect / IntRegion because nsRect doesn't have +// InflateToMultiple which is required by TiledRegion. +TEST(Gfx, TiledRegionNoSimplification2Rects) { + // Add two rectangles, both rectangles are completely inside + // different tiles. + nsIntRegion region; + region.OrWith(nsIntRect(50, 50, 50, 50)); + region.OrWith(nsIntRect(300, 50, 50, 50)); + + TiledIntRegion tiledRegion; + tiledRegion.Add(nsIntRect(50, 50, 50, 50)); + tiledRegion.Add(nsIntRect(300, 50, 50, 50)); + + // No simplification should have happened. + EXPECT_TRUE(region.IsEqual(tiledRegion.GetRegion())); +} + +TEST(Gfx, TiledRegionNoSimplification1Region) { + // Add two rectangles, both rectangles are completely inside + // different tiles. + nsIntRegion region; + region.OrWith(nsIntRect(50, 50, 50, 50)); + region.OrWith(nsIntRect(300, 50, 50, 50)); + + TiledIntRegion tiledRegion; + tiledRegion.Add(region); + + // No simplification should have happened. + EXPECT_TRUE(region.IsEqual(tiledRegion.GetRegion())); +} + +TEST(Gfx, TiledRegionWithSimplification3Rects) { + // Add three rectangles. The first two rectangles are completely inside + // different tiles, but the third rectangle intersects both tiles. + TiledIntRegion tiledRegion; + tiledRegion.Add(nsIntRect(50, 50, 50, 50)); + tiledRegion.Add(nsIntRect(300, 50, 50, 50)); + tiledRegion.Add(nsIntRect(250, 70, 10, 10)); + + // Both tiles should have simplified their rectangles, and those two + // rectangles are adjacent to each other, so they just build up one rect. + EXPECT_TRUE(tiledRegion.GetRegion().IsEqual(nsIntRect(50, 50, 300, 50))); +} + +TEST(Gfx, TiledRegionWithSimplification1Region) { + // Add three rectangles. The first two rectangles are completely inside + // different tiles, but the third rectangle intersects both tiles. + nsIntRegion region; + region.OrWith(nsIntRect(50, 50, 50, 50)); + region.OrWith(nsIntRect(300, 50, 50, 50)); + region.OrWith(nsIntRect(250, 70, 10, 10)); + + TiledIntRegion tiledRegion; + tiledRegion.Add(region); + + // Both tiles should have simplified their rectangles, and those two + // rectangles are adjacent to each other, so they just build up one rect. + EXPECT_TRUE(tiledRegion.GetRegion().IsEqual(nsIntRect(50, 50, 300, 50))); +} + +TEST(Gfx, TiledRegionContains) { + // Add three rectangles. The first two rectangles are completely inside + // different tiles, but the third rectangle intersects both tiles. + TiledIntRegion tiledRegion; + tiledRegion.Add(nsIntRect(50, 50, 50, 50)); + tiledRegion.Add(nsIntRect(300, 50, 50, 50)); + tiledRegion.Add(nsIntRect(250, 70, 10, 10)); + + // Both tiles should have simplified their rectangles, and those two + // rectangles are adjacent to each other, so they just build up one rect. + EXPECT_TRUE(tiledRegion.Contains(nsIntRect(50, 50, 300, 50))); + EXPECT_TRUE(tiledRegion.Contains(nsIntRect(50, 50, 50, 50))); + EXPECT_FALSE(tiledRegion.Contains(nsIntRect(50, 50, 301, 50))); +} + +TEST(Gfx, TiledRegionIntersects) { + // Add three rectangles. The first two rectangles are completely inside + // different tiles, but the third rectangle intersects both tiles. + TiledIntRegion tiledRegion; + tiledRegion.Add(nsIntRect(50, 50, 50, 50)); + tiledRegion.Add(nsIntRect(300, 50, 50, 50)); + tiledRegion.Add(nsIntRect(250, 70, 10, 10)); + + // Both tiles should have simplified their rectangles, and those two + // rectangles are adjacent to each other, so they just build up one rect. + EXPECT_TRUE(tiledRegion.Intersects(nsIntRect(50, 50, 300, 50))); + EXPECT_TRUE(tiledRegion.Intersects(nsIntRect(200, 10, 10, 50))); + EXPECT_TRUE(tiledRegion.Intersects(nsIntRect(50, 50, 301, 50))); + EXPECT_FALSE(tiledRegion.Intersects(nsIntRect(0, 0, 50, 500))); +} + MOZ_GTEST_BENCH(GfxBench, RegionOr, []{ const int size = 5000; From 40e0b92cb88d0df73ab88650d5c574b7df0c8fc4 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 18 Apr 2016 13:49:14 -0400 Subject: [PATCH 10/93] Bug 1236043 - Use TiledRegion for the invalid region of a layer. r=jrmuizel MozReview-Commit-ID: BNUyUPbrnU1 --HG-- extra : rebase_source : 80342a281d6fd30ba8d12b77b3af4aec60376294 --- gfx/layers/LayerTreeInvalidation.cpp | 4 +--- gfx/layers/Layers.h | 15 ++++++++++----- gfx/layers/basic/BasicPaintedLayer.h | 5 ++--- gfx/layers/client/ClientPaintedLayer.h | 5 ++--- gfx/layers/client/ClientTiledPaintedLayer.h | 8 ++++---- gfx/layers/ipc/ShadowLayers.cpp | 2 +- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/gfx/layers/LayerTreeInvalidation.cpp b/gfx/layers/LayerTreeInvalidation.cpp index 81ed9f263b65..77b99835d5ca 100644 --- a/gfx/layers/LayerTreeInvalidation.cpp +++ b/gfx/layers/LayerTreeInvalidation.cpp @@ -132,7 +132,6 @@ struct LayerPropertiesBase : public LayerProperties : mLayer(aLayer) , mMaskLayer(nullptr) , mVisibleRegion(mLayer->GetLocalVisibleRegion().ToUnknownRegion()) - , mInvalidRegion(aLayer->GetInvalidRegion()) , mPostXScale(aLayer->GetPostXScale()) , mPostYScale(aLayer->GetPostYScale()) , mOpacity(aLayer->GetLocalOpacity()) @@ -202,7 +201,7 @@ struct LayerPropertiesBase : public LayerProperties } AddRegion(result, ComputeChangeInternal(aCallback, aGeometryChanged)); - AddTransformedRegion(result, mLayer->GetInvalidRegion(), mTransform); + AddTransformedRegion(result, mLayer->GetInvalidRegion().GetRegion(), mTransform); if (mMaskLayer && otherMask) { AddTransformedRegion(result, mMaskLayer->ComputeChange(aCallback, aGeometryChanged), @@ -252,7 +251,6 @@ struct LayerPropertiesBase : public LayerProperties UniquePtr mMaskLayer; nsTArray> mAncestorMaskLayers; nsIntRegion mVisibleRegion; - nsIntRegion mInvalidRegion; Matrix4x4 mTransform; float mPostXScale; float mPostYScale; diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index 09f739904f21..ed61bd5e6f1f 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -28,6 +28,7 @@ #include "mozilla/gfx/BaseMargin.h" // for BaseMargin #include "mozilla/gfx/BasePoint.h" // for BasePoint #include "mozilla/gfx/Point.h" // for IntSize +#include "mozilla/gfx/TiledRegion.h" // for TiledIntRegion #include "mozilla/gfx/Types.h" // for SurfaceFormat #include "mozilla/gfx/UserData.h" // for UserData, etc #include "mozilla/layers/LayersTypes.h" @@ -1662,20 +1663,24 @@ public: * Returns the current area of the layer (in layer-space coordinates) * marked as needed to be recomposited. */ - const nsIntRegion& GetInvalidRegion() { return mInvalidRegion; } + const gfx::TiledIntRegion& GetInvalidRegion() { return mInvalidRegion; } void AddInvalidRegion(const nsIntRegion& aRegion) { - mInvalidRegion.Or(mInvalidRegion, aRegion); + mInvalidRegion.Add(aRegion); } /** * Mark the entirety of the layer's visible region as being invalid. */ - void SetInvalidRectToVisibleRegion() { mInvalidRegion = GetVisibleRegion().ToUnknownRegion(); } + void SetInvalidRectToVisibleRegion() + { + mInvalidRegion.SetEmpty(); + mInvalidRegion.Add(GetVisibleRegion().ToUnknownRegion()); + } /** * Adds to the current invalid rect. */ - void AddInvalidRect(const gfx::IntRect& aRect) { mInvalidRegion.Or(mInvalidRegion, aRect); } + void AddInvalidRect(const gfx::IntRect& aRect) { mInvalidRegion.Add(aRect); } /** * Clear the invalid rect, marking the layer as being identical to what is currently @@ -1833,7 +1838,7 @@ protected: bool mForceIsolatedGroup; Maybe mClipRect; gfx::IntRect mTileSourceRect; - nsIntRegion mInvalidRegion; + gfx::TiledIntRegion mInvalidRegion; nsTArray > mApzcs; uint32_t mContentFlags; bool mUseTileSourceRect; diff --git a/gfx/layers/basic/BasicPaintedLayer.h b/gfx/layers/basic/BasicPaintedLayer.h index 4518b64fce9d..59f71b20ce07 100644 --- a/gfx/layers/basic/BasicPaintedLayer.h +++ b/gfx/layers/basic/BasicPaintedLayer.h @@ -54,9 +54,8 @@ public: { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); - mInvalidRegion.Or(mInvalidRegion, aRegion); - mInvalidRegion.SimplifyOutward(20); - mValidRegion.Sub(mValidRegion, mInvalidRegion); + mInvalidRegion.Add(aRegion); + mValidRegion.Sub(mValidRegion, mInvalidRegion.GetRegion()); } virtual void PaintThebes(gfxContext* aContext, diff --git a/gfx/layers/client/ClientPaintedLayer.h b/gfx/layers/client/ClientPaintedLayer.h index 7387ee1c13fd..949f746aea5f 100644 --- a/gfx/layers/client/ClientPaintedLayer.h +++ b/gfx/layers/client/ClientPaintedLayer.h @@ -60,9 +60,8 @@ public: { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); - mInvalidRegion.Or(mInvalidRegion, aRegion); - mInvalidRegion.SimplifyOutward(20); - mValidRegion.Sub(mValidRegion, mInvalidRegion); + mInvalidRegion.Add(aRegion); + mValidRegion.Sub(mValidRegion, mInvalidRegion.GetRegion()); } virtual void RenderLayer() override { RenderLayerWithReadback(nullptr); } diff --git a/gfx/layers/client/ClientTiledPaintedLayer.h b/gfx/layers/client/ClientTiledPaintedLayer.h index 30259f9802cd..9e1e003ee5df 100644 --- a/gfx/layers/client/ClientTiledPaintedLayer.h +++ b/gfx/layers/client/ClientTiledPaintedLayer.h @@ -54,10 +54,10 @@ public: // PaintedLayer virtual Layer* AsLayer() override { return this; } virtual void InvalidateRegion(const nsIntRegion& aRegion) override { - mInvalidRegion.Or(mInvalidRegion, aRegion); - mInvalidRegion.SimplifyOutward(20); - mValidRegion.Sub(mValidRegion, mInvalidRegion); - mLowPrecisionValidRegion.Sub(mLowPrecisionValidRegion, mInvalidRegion); + mInvalidRegion.Add(aRegion); + nsIntRegion invalidRegion = mInvalidRegion.GetRegion(); + mValidRegion.Sub(mValidRegion, invalidRegion); + mLowPrecisionValidRegion.Sub(mLowPrecisionValidRegion, invalidRegion); } // Shadow methods diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index c81284d8bd7a..700fa1e60426 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -844,7 +844,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray* aReplies, } common.maskLayerParent() = nullptr; common.animations() = mutant->GetAnimations(); - common.invalidRegion() = mutant->GetInvalidRegion(); + common.invalidRegion() = mutant->GetInvalidRegion().GetRegion(); common.scrollMetadata() = mutant->GetAllScrollMetadata(); for (size_t i = 0; i < mutant->GetAncestorMaskLayerCount(); i++) { auto layer = Shadow(mutant->GetAncestorMaskLayerAt(i)->AsShadowableLayer()); From 2e917fb8fa232e1cdd6faa978c6aeaf9a3e2d255 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 18 Apr 2016 14:18:44 -0400 Subject: [PATCH 11/93] Bug 1236043 - Adjust reftests and reftest annotations for new invalid region simplification. r=jrmuizel Make the test_transformed_scrolling_repaints* tests taller so that the top and the bottom of the scrolled area don't share the same tile. Fuzz layout/reftests/text/wordwrap-03.html on Linux because the native textbox gradient is painted in a slightly different position depending on the invalid area. Mark layout/reftests/forms/select/out-of-bounds-selectedindex.html as fuzzy on Android because some listbox rounded corner pixel differs with the new invalidation behavior. Mark layout/reftests/bugs/456219-1c.html as fuzzy on Linux, reasons unknown. :-( Disable flexbox-widget-flex-items-3.html because of bad file input drawing on Linux, see bug 1260965. MozReview-Commit-ID: B5c1a8D0G8F --HG-- extra : rebase_source : 3e281d035831c77246d0e439246fdab9395dc884 --- .../test_transformed_scrolling_repaints.html | 4 +-- ...ansformed_scrolling_repaints_3_window.html | 34 ++++++++++++++++++- layout/reftests/bugs/reftest.list | 4 +-- layout/reftests/flexbox/reftest.list | 2 +- layout/reftests/forms/select/reftest.list | 2 +- layout/reftests/text/reftest.list | 2 +- 6 files changed, 40 insertions(+), 8 deletions(-) diff --git a/layout/base/tests/test_transformed_scrolling_repaints.html b/layout/base/tests/test_transformed_scrolling_repaints.html index d77cb9fad73c..00e6cbfd5215 100644 --- a/layout/base/tests/test_transformed_scrolling_repaints.html +++ b/layout/base/tests/test_transformed_scrolling_repaints.html @@ -7,10 +7,10 @@ -
+
Hello
Kitty
-
Kitty
+
Kitty
 
+
+
diff --git a/toolkit/content/browser-child.js b/toolkit/content/browser-child.js
index e7faaf64c291..05efeb97851c 100644
--- a/toolkit/content/browser-child.js
+++ b/toolkit/content/browser-child.js
@@ -130,9 +130,9 @@ var WebProgressListener = {
       json.documentURI = content.document.documentURIObject.spec;
       json.charset = content.document.characterSet;
       json.mayEnableCharacterEncodingMenu = docShell.mayEnableCharacterEncodingMenu;
+      json.inLoadURI = WebNavigation.inLoadURI;
     }
 
-    json.inLoadURI = WebNavigation.inLoadURI;
     this._send("Content:StateChange", json, objects);
   },
 
@@ -171,6 +171,7 @@ var WebProgressListener = {
       json.mayEnableCharacterEncodingMenu = docShell.mayEnableCharacterEncodingMenu;
       json.principal = content.document.nodePrincipal;
       json.synthetic = content.document.mozSyntheticDocument;
+      json.inLoadURI = WebNavigation.inLoadURI;
 
       if (AppConstants.MOZ_CRASHREPORTER && CrashReporter.enabled) {
         let uri = aLocationURI.clone();
diff --git a/toolkit/modules/RemoteWebProgress.jsm b/toolkit/modules/RemoteWebProgress.jsm
index 2bb27a99ab9d..0031d6b98c56 100644
--- a/toolkit/modules/RemoteWebProgress.jsm
+++ b/toolkit/modules/RemoteWebProgress.jsm
@@ -220,7 +220,9 @@ RemoteWebProgressManager.prototype = {
     if (isTopLevel) {
       this._browser._contentWindow = objects.contentWindow;
       this._browser._documentContentType = json.documentContentType;
-      this._browser.inLoadURI = json.inLoadURI;
+      if (typeof json.inLoadURI != "undefined") {
+        this._browser.inLoadURI = json.inLoadURI;
+      }
       if (json.charset) {
         this._browser._characterSet = json.charset;
         this._browser._mayEnableCharacterEncodingMenu = json.mayEnableCharacterEncodingMenu;

From 5c75dc87d3ec2654520f743269e62016f0c119d5 Mon Sep 17 00:00:00 2001
From: Terrence Cole 
Date: Mon, 18 Apr 2016 15:50:28 -0700
Subject: [PATCH 32/93] Backout ab87b53b3140 (Bug 1263771) for breaking the
 MSVC2013 build 2 days before uplift.

--HG--
extra : rebase_source : 7a2e41bf68aba3b536355de937e4eb7f42e00bb7
---
 js/src/jscompartment.cpp        |  7 ++++++-
 js/src/jscompartment.h          |  3 ++-
 js/src/jsgc.cpp                 | 12 ++++++++++++
 js/src/vm/ArrayBufferObject.cpp | 10 ++++------
 js/src/vm/ArrayBufferObject.h   | 25 +------------------------
 5 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp
index c289adcd6fe7..c1c9729bec30 100644
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -70,7 +70,6 @@ JSCompartment::JSCompartment(Zone* zone, const JS::CompartmentOptions& options =
     initialShapes(zone, InitialShapeSet()),
     selfHostingScriptSource(nullptr),
     objectMetadataTable(nullptr),
-    innerViews(zone, InnerViewTable()),
     lazyArrayBuffers(nullptr),
     nonSyntacticLexicalScopes_(nullptr),
     gcIncomingGrayPointers(nullptr),
@@ -667,6 +666,12 @@ JSCompartment::sweepAfterMinorGC()
         innerViews.sweepAfterMinorGC();
 }
 
+void
+JSCompartment::sweepInnerViews()
+{
+    innerViews.sweep();
+}
+
 void
 JSCompartment::sweepSavedStacks()
 {
diff --git a/js/src/jscompartment.h b/js/src/jscompartment.h
index 349d9a5a1fcc..b2104d9527d1 100644
--- a/js/src/jscompartment.h
+++ b/js/src/jscompartment.h
@@ -464,7 +464,7 @@ struct JSCompartment
     js::ObjectWeakMap* objectMetadataTable;
 
     // Map from array buffers to views sharing that storage.
-    JS::WeakCache innerViews;
+    js::InnerViewTable innerViews;
 
     // Inline transparent typed objects do not initially have an array buffer,
     // but can have that buffer created lazily if it is accessed later. This
@@ -584,6 +584,7 @@ struct JSCompartment
 
     void sweepAfterMinorGC();
 
+    void sweepInnerViews();
     void sweepCrossCompartmentWrappers();
     void sweepSavedStacks();
     void sweepGlobalObject(js::FreeOp* fop);
diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp
index db9ff427656c..7a681e60864a 100644
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -2461,6 +2461,7 @@ GCRuntime::sweepZoneAfterCompacting(Zone* zone)
         cache->sweep();
 
     for (CompartmentsInZoneIter c(zone); !c.done(); c.next()) {
+        c->sweepInnerViews();
         c->objectGroups.sweep(fop);
         c->sweepRegExps();
         c->sweepSavedStacks();
@@ -5069,6 +5070,7 @@ class SweepWeakCacheTask : public GCSweepTask
         explicit name (JSRuntime* rt) : GCSweepTask(rt) {}                    \
     }
 MAKE_GC_SWEEP_TASK(SweepAtomsTask);
+MAKE_GC_SWEEP_TASK(SweepInnerViewsTask);
 MAKE_GC_SWEEP_TASK(SweepCCWrappersTask);
 MAKE_GC_SWEEP_TASK(SweepBaseShapesTask);
 MAKE_GC_SWEEP_TASK(SweepInitialShapesTask);
@@ -5083,6 +5085,13 @@ SweepAtomsTask::run()
     runtime->sweepAtoms();
 }
 
+/* virtual */ void
+SweepInnerViewsTask::run()
+{
+    for (GCCompartmentGroupIter c(runtime); !c.done(); c.next())
+        c->sweepInnerViews();
+}
+
 /* virtual */ void
 SweepCCWrappersTask::run()
 {
@@ -5164,6 +5173,7 @@ GCRuntime::beginSweepingZoneGroup()
 
     FreeOp fop(rt);
     SweepAtomsTask sweepAtomsTask(rt);
+    SweepInnerViewsTask sweepInnerViewsTask(rt);
     SweepCCWrappersTask sweepCCWrappersTask(rt);
     SweepObjectGroupsTask sweepObjectGroupsTask(rt);
     SweepRegExpsTask sweepRegExpsTask(rt);
@@ -5217,6 +5227,7 @@ GCRuntime::beginSweepingZoneGroup()
 
         {
             AutoLockHelperThreadState helperLock;
+            startTask(sweepInnerViewsTask, gcstats::PHASE_SWEEP_INNER_VIEWS);
             startTask(sweepCCWrappersTask, gcstats::PHASE_SWEEP_CC_WRAPPER);
             startTask(sweepObjectGroupsTask, gcstats::PHASE_SWEEP_TYPE_OBJECT);
             startTask(sweepRegExpsTask, gcstats::PHASE_SWEEP_REGEXP);
@@ -5297,6 +5308,7 @@ GCRuntime::beginSweepingZoneGroup()
         gcstats::AutoSCC scc(stats, zoneGroupIndex);
 
         AutoLockHelperThreadState helperLock;
+        joinTask(sweepInnerViewsTask, gcstats::PHASE_SWEEP_INNER_VIEWS);
         joinTask(sweepCCWrappersTask, gcstats::PHASE_SWEEP_CC_WRAPPER);
         joinTask(sweepObjectGroupsTask, gcstats::PHASE_SWEEP_TYPE_OBJECT);
         joinTask(sweepRegExpsTask, gcstats::PHASE_SWEEP_REGEXP);
diff --git a/js/src/vm/ArrayBufferObject.cpp b/js/src/vm/ArrayBufferObject.cpp
index 66e81c7c3aac..b3e0c80548eb 100644
--- a/js/src/vm/ArrayBufferObject.cpp
+++ b/js/src/vm/ArrayBufferObject.cpp
@@ -292,11 +292,10 @@ ArrayBufferObject::detach(JSContext* cx, Handle buffer,
     // Update all views of the buffer to account for the buffer having been
     // detached, and clear the buffer's data and list of views.
 
-    auto& innerViews = cx->compartment()->innerViews;
-    if (InnerViewTable::ViewVector* views = innerViews.maybeViewsUnbarriered(buffer)) {
+    if (InnerViewTable::ViewVector* views = cx->compartment()->innerViews.maybeViewsUnbarriered(buffer)) {
         for (size_t i = 0; i < views->length(); i++)
             NoteViewBufferWasDetached((*views)[i], newContents, cx);
-        innerViews.removeViews(buffer);
+        cx->compartment()->innerViews.removeViews(buffer);
     }
     if (buffer->firstView()) {
         if (buffer->forInlineTypedObject()) {
@@ -365,8 +364,7 @@ ArrayBufferObject::changeContents(JSContext* cx, BufferContents newContents)
     setNewOwnedData(cx->runtime()->defaultFreeOp(), newContents);
 
     // Update all views.
-    auto& innerViews = cx->compartment()->innerViews;
-    if (InnerViewTable::ViewVector* views = innerViews.maybeViewsUnbarriered(this)) {
+    if (InnerViewTable::ViewVector* views = cx->compartment()->innerViews.maybeViewsUnbarriered(this)) {
         for (size_t i = 0; i < views->length(); i++)
             changeViewContents(cx, (*views)[i], oldDataPointer, newContents);
     }
@@ -857,7 +855,7 @@ ArrayBufferObject::addView(JSContext* cx, JSObject* viewArg)
         setFirstView(view);
         return true;
     }
-    return cx->compartment()->innerViews.get().addView(cx, this, view);
+    return cx->compartment()->innerViews.addView(cx, this, view);
 }
 
 /*
diff --git a/js/src/vm/ArrayBufferObject.h b/js/src/vm/ArrayBufferObject.h
index 848b6a515a21..f8f97f32f043 100644
--- a/js/src/vm/ArrayBufferObject.h
+++ b/js/src/vm/ArrayBufferObject.h
@@ -500,7 +500,6 @@ class InnerViewTable
     typedef Vector ViewVector;
 
     friend class ArrayBufferObject;
-    friend class WeakCacheBase;
 
   private:
     struct MapGCPolicy {
@@ -554,35 +553,13 @@ class InnerViewTable
     void sweep();
     void sweepAfterMinorGC();
 
-    bool needsSweepAfterMinorGC() const {
+    bool needsSweepAfterMinorGC() {
         return !nurseryKeys.empty() || !nurseryKeysValid;
     }
 
     size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf);
 };
 
-template <>
-class WeakCacheBase
-{
-    InnerViewTable& table() {
-        return static_cast*>(this)->get();
-    }
-    const InnerViewTable& table() const {
-        return static_cast*>(this)->get();
-    }
-
-  public:
-    InnerViewTable::ViewVector* maybeViewsUnbarriered(ArrayBufferObject* obj) {
-        return table().maybeViewsUnbarriered(obj);
-    }
-    void removeViews(ArrayBufferObject* obj) { table().removeViews(obj); }
-    void sweepAfterMinorGC() { table().sweepAfterMinorGC(); }
-    bool needsSweepAfterMinorGC() const { return table().needsSweepAfterMinorGC(); }
-    size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) {
-        return table().sizeOfExcludingThis(mallocSizeOf);
-    }
-};
-
 extern JSObject*
 InitArrayBufferClass(JSContext* cx, HandleObject obj);
 

From bd4c2f5dc7918dac0f63808c0c9bb63c6f3d2175 Mon Sep 17 00:00:00 2001
From: Matt Woodrow 
Date: Tue, 19 Apr 2016 11:20:33 +1200
Subject: [PATCH 33/93] Bug 1263480 - Don't let cairo go into an error state
 when DrawSurface is called with an empty destination rectangle. r=lsalzman

---
 gfx/2d/DrawTargetCairo.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gfx/2d/DrawTargetCairo.cpp b/gfx/2d/DrawTargetCairo.cpp
index ad782188374c..55096c008444 100644
--- a/gfx/2d/DrawTargetCairo.cpp
+++ b/gfx/2d/DrawTargetCairo.cpp
@@ -829,7 +829,7 @@ DrawTargetCairo::DrawSurface(SourceSurface *aSurface,
                              const DrawSurfaceOptions &aSurfOptions,
                              const DrawOptions &aOptions)
 {
-  if (mTransformSingular) {
+  if (mTransformSingular || aDest.IsEmpty()) {
     return;
   }
 

From f858198ac34bef9a0704c54369fb38dcccd1dbf2 Mon Sep 17 00:00:00 2001
From: Blake Kaplan 
Date: Fri, 8 Apr 2016 11:21:07 -0700
Subject: [PATCH 34/93] Bug 1258921 - Expose logininfo's guid to the content
 process and use it to delete logins via the autocomplete popup. r=MattN

---
 .../components/passwordmgr/LoginHelper.jsm    | 49 +++++++++++++++++++
 .../passwordmgr/LoginManagerContent.jsm       | 49 ++++++++++---------
 .../passwordmgr/LoginManagerParent.jsm        | 15 ++++--
 .../components/passwordmgr/nsLoginManager.js  |  4 +-
 .../components/satchel/AutoCompleteE10S.jsm   | 18 ++++++-
 5 files changed, 104 insertions(+), 31 deletions(-)

diff --git a/toolkit/components/passwordmgr/LoginHelper.jsm b/toolkit/components/passwordmgr/LoginHelper.jsm
index b9ff8b010d1f..70c4cc53f7c2 100644
--- a/toolkit/components/passwordmgr/LoginHelper.jsm
+++ b/toolkit/components/passwordmgr/LoginHelper.jsm
@@ -401,5 +401,54 @@ this.LoginHelper = {
       return;
     }
     Services.logins.addLogin(login);
+  },
+
+  /**
+   * Convert an array of nsILoginInfo to vanilla JS objects suitable for
+   * sending over IPC.
+   *
+   * NB: All members of nsILoginInfo and nsILoginMetaInfo are strings.
+   */
+  loginsToVanillaObjects(logins) {
+    return logins.map(this.loginToVanillaObject);
+  },
+
+  /**
+   * Same as above, but for a single login.
+   */
+  loginToVanillaObject(login) {
+    let obj = {};
+    for (let i in login) {
+      if (typeof login[i] !== 'function') {
+        obj[i] = login[i];
+      }
+    }
+
+    login.QueryInterface(Ci.nsILoginMetaInfo);
+    obj.guid = login.guid;
+    return obj;
+  },
+
+  /**
+   * Convert an object received from IPC into an nsILoginInfo (with guid).
+   */
+  vanillaObjectToLogin(login) {
+    var formLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
+                  createInstance(Ci.nsILoginInfo);
+    formLogin.init(login.hostname, login.formSubmitURL,
+                   login.httpRealm, login.username,
+                   login.password, login.usernameField,
+                   login.passwordField);
+
+    formLogin.QueryInterface(Ci.nsILoginMetaInfo);
+    formLogin.guid = login.guid;
+    return formLogin;
+  },
+
+  /**
+   * As above, but for an array of objects.
+   */
+  vanillaObjectsToLogins(logins) {
+    return logins.map(this.vanillaObjectToLogin);
   }
 };
diff --git a/toolkit/components/passwordmgr/LoginManagerContent.jsm b/toolkit/components/passwordmgr/LoginManagerContent.jsm
index 8e1c667bb569..4a078b353b6b 100644
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -176,25 +176,11 @@ var LoginManagerContent = {
   },
 
   receiveMessage: function (msg, window) {
-    // Convert an array of logins in simple JS-object form to an array of
-    // nsILoginInfo objects.
-    function jsLoginsToXPCOM(logins) {
-      return logins.map(login => {
-        var formLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
-                      createInstance(Ci.nsILoginInfo);
-        formLogin.init(login.hostname, login.formSubmitURL,
-                       login.httpRealm, login.username,
-                       login.password, login.usernameField,
-                       login.passwordField);
-        return formLogin;
-      });
-    }
-
     if (msg.name == "RemoteLogins:fillForm") {
       this.fillForm({
         topDocument: window.document,
         loginFormOrigin: msg.data.loginFormOrigin,
-        loginsFound: jsLoginsToXPCOM(msg.data.logins),
+        loginsFound: LoginHelper.vanillaObjectsToLogins(msg.data.logins),
         recipes: msg.data.recipes,
         inputElement: msg.objects.inputElement,
       });
@@ -204,7 +190,7 @@ var LoginManagerContent = {
     let request = this._takeRequest(msg);
     switch (msg.name) {
       case "RemoteLogins:loginsFound": {
-        let loginsFound = jsLoginsToXPCOM(msg.data.logins);
+        let loginsFound = LoginHelper.vanillaObjectsToLogins(msg.data.logins);
         request.promise.resolve({
           form: request.form,
           loginsFound: loginsFound,
@@ -214,8 +200,15 @@ var LoginManagerContent = {
       }
 
       case "RemoteLogins:loginsAutoCompleted": {
-        let loginsFound = jsLoginsToXPCOM(msg.data.logins);
-        request.promise.resolve(loginsFound);
+        let loginsFound =
+          LoginHelper.vanillaObjectsToLogins(msg.data.logins);
+        // If we're in the parent process, don't pass a message manager so our
+        // autocomplete result objects know they can remove the login from the
+        // login manager directly.
+        let messageManager =
+          (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_CONTENT) ?
+            msg.target : undefined;
+        request.promise.resolve({ logins: loginsFound, messageManager });
         break;
       }
     }
@@ -262,11 +255,16 @@ var LoginManagerContent = {
     let remote = (Services.appinfo.processType ===
                   Services.appinfo.PROCESS_TYPE_CONTENT);
 
+    let previousResult = aPreviousResult ?
+                           { searchString: aPreviousResult.searchString,
+                             logins: LoginHelper.loginsToVanillaObjects(aPreviousResult.logins) } :
+                           null;
+
     let requestData = {};
     let messageData = { formOrigin: formOrigin,
                         actionOrigin: actionOrigin,
                         searchString: aSearchString,
-                        previousResult: aPreviousResult,
+                        previousResult: previousResult,
                         rect: aRect,
                         remote: remote };
 
@@ -1180,7 +1178,7 @@ var LoginUtils = {
 };
 
 // nsIAutoCompleteResult implementation
-function UserAutoCompleteResult (aSearchString, matchingLogins) {
+function UserAutoCompleteResult (aSearchString, matchingLogins, messageManager) {
   function loginSort(a,b) {
     var userA = a.username.toLowerCase();
     var userB = b.username.toLowerCase();
@@ -1197,6 +1195,7 @@ function UserAutoCompleteResult (aSearchString, matchingLogins) {
   this.searchString = aSearchString;
   this.logins = matchingLogins.sort(loginSort);
   this.matchCount = matchingLogins.length;
+  this._messageManager = messageManager;
 
   if (this.matchCount > 0) {
     this.searchResult = Ci.nsIAutoCompleteResult.RESULT_SUCCESS;
@@ -1262,9 +1261,13 @@ UserAutoCompleteResult.prototype = {
       this.defaultIndex--;
 
     if (removeFromDB) {
-      var pwmgr = Cc["@mozilla.org/login-manager;1"].
-                  getService(Ci.nsILoginManager);
-      pwmgr.removeLogin(removedLogin);
+      if (this._messageManager) {
+        let vanilla = LoginHelper.loginToVanillaObject(removedLogin);
+        this._messageManager.sendAsyncMessage("RemoteLogins:removeLogin",
+                                              { login: vanilla });
+      } else {
+        Services.logins.removeLogin(removedLogin);
+      }
     }
   }
 };
diff --git a/toolkit/components/passwordmgr/LoginManagerParent.jsm b/toolkit/components/passwordmgr/LoginManagerParent.jsm
index 31c3bb40914d..6b35aa201819 100644
--- a/toolkit/components/passwordmgr/LoginManagerParent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm
@@ -47,6 +47,7 @@ var LoginManagerParent = {
     mm.addMessageListener("RemoteLogins:findRecipes", this);
     mm.addMessageListener("RemoteLogins:onFormSubmit", this);
     mm.addMessageListener("RemoteLogins:autoCompleteLogins", this);
+    mm.addMessageListener("RemoteLogins:removeLogin", this);
     mm.addMessageListener("RemoteLogins:updateLoginFormPresence", this);
 
     XPCOMUtils.defineLazyGetter(this, "recipeParentPromise", () => {
@@ -98,6 +99,12 @@ var LoginManagerParent = {
         this.doAutocompleteSearch(data, msg.target);
         break;
       }
+
+      case "RemoteLogins:removeLogin": {
+        let login = LoginHelper.vanillaObjectToLogin(data.login);
+        AutoCompleteE10S.removeLogin(login);
+        break;
+      }
     }
 
     return undefined;
@@ -122,7 +129,7 @@ var LoginManagerParent = {
 
     // Convert the array of nsILoginInfo to vanilla JS objects since nsILoginInfo
     // doesn't support structured cloning.
-    let jsLogins = JSON.parse(JSON.stringify([login]));
+    let jsLogins = [LoginHelper.loginToVanillaObject(login)];
 
     let objects = inputElement ? {inputElement} : null;
     browser.messageManager.sendAsyncMessage("RemoteLogins:fillForm", {
@@ -218,7 +225,7 @@ var LoginManagerParent = {
     var logins = Services.logins.findLogins({}, formOrigin, actionOrigin, null);
     // Convert the array of nsILoginInfo to vanilla JS objects since nsILoginInfo
     // doesn't support structured cloning.
-    var jsLogins = JSON.parse(JSON.stringify(logins));
+    var jsLogins = LoginHelper.loginsToVanillaObjects(logins);
     target.sendAsyncMessage("RemoteLogins:loginsFound", {
       requestId: requestId,
       logins: jsLogins,
@@ -251,7 +258,7 @@ var LoginManagerParent = {
 
       // We have a list of results for a shorter search string, so just
       // filter them further based on the new search string.
-      logins = previousResult.logins;
+      logins = LoginHelper.vanillaObjectsToLogins(previousResult.logins);
     } else {
       log("Creating new autocomplete search result.");
 
@@ -279,7 +286,7 @@ var LoginManagerParent = {
 
     // Convert the array of nsILoginInfo to vanilla JS objects since nsILoginInfo
     // doesn't support structured cloning.
-    var jsLogins = JSON.parse(JSON.stringify(matchingLogins));
+    var jsLogins = LoginHelper.loginsToVanillaObjects(matchingLogins);
     target.messageManager.sendAsyncMessage("RemoteLogins:loginsAutoCompleted", {
       requestId: requestId,
       logins: jsLogins,
diff --git a/toolkit/components/passwordmgr/nsLoginManager.js b/toolkit/components/passwordmgr/nsLoginManager.js
index 8890078aaf20..0db4933ddf49 100644
--- a/toolkit/components/passwordmgr/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/nsLoginManager.js
@@ -463,9 +463,9 @@ LoginManager.prototype = {
     let rect = BrowserUtils.getElementBoundingScreenRect(aElement);
     LoginManagerContent._autoCompleteSearchAsync(aSearchString, previousResult,
                                                  aElement, rect)
-                       .then(function(logins) {
+                       .then(function({ logins, messageManager }) {
                          let results =
-                             new UserAutoCompleteResult(aSearchString, logins);
+                             new UserAutoCompleteResult(aSearchString, logins, messageManager);
                          aCallback.onSearchCompletion(results);
                        })
                        .then(null, Cu.reportError);
diff --git a/toolkit/components/satchel/AutoCompleteE10S.jsm b/toolkit/components/satchel/AutoCompleteE10S.jsm
index 1d8d398027a2..61859bfdbf36 100644
--- a/toolkit/components/satchel/AutoCompleteE10S.jsm
+++ b/toolkit/components/satchel/AutoCompleteE10S.jsm
@@ -147,8 +147,22 @@ this.AutoCompleteE10S = {
     this._showPopup(results);
   },
 
-  removeEntry(index) {
-    this._resultCache.removeValueAt(index, true);
+  removeLogin(login) {
+    Services.logins.removeLogin(login);
+
+    // It's possible to race and have the deleted login no longer be in our
+    // resultCache's logins, so we remove it from the database above and only
+    // deal with our resultCache below.
+    let idx = this._resultCache.logins.findIndex(cur => {
+      return login.guid === cur.QueryInterface(Ci.nsILoginMetaInfo).guid
+    });
+    if (idx !== -1) {
+      this.removeEntry(idx, false);
+    }
+  },
+
+  removeEntry(index, updateDB = true) {
+    this._resultCache.removeValueAt(index, updateDB);
 
     let selectedIndex = this.popup.selectedIndex;
     this.showPopupWithResults(this._popupCache.browserWindow,

From d056b90405a96e538b5f6ebb62ff533eb8022325 Mon Sep 17 00:00:00 2001
From: Blake Kaplan 
Date: Tue, 12 Apr 2016 12:19:58 -0700
Subject: [PATCH 35/93] Bug 1259303 - Properly cancel login manager async
 searches to avoid assertions. r=MattN

---
 .../passwordmgr/nsILoginManager.idl           |  5 ++++
 .../components/passwordmgr/nsLoginManager.js  | 29 ++++++++++++++-----
 .../satchel/nsFormFillController.cpp          |  2 ++
 3 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/toolkit/components/passwordmgr/nsILoginManager.idl b/toolkit/components/passwordmgr/nsILoginManager.idl
index 2df13cf03619..d23265f555ee 100644
--- a/toolkit/components/passwordmgr/nsILoginManager.idl
+++ b/toolkit/components/passwordmgr/nsILoginManager.idl
@@ -215,6 +215,11 @@ interface nsILoginManager : nsISupports {
                                in nsIDOMHTMLInputElement aElement,
                                in nsIFormAutoCompleteObserver aListener);
 
+  /**
+   * Stop a previously-started async search.
+   */
+  void stopSearch();
+
   /**
    * Search for logins in the login manager. An array is always returned;
    * if there are no logins the array is empty.
diff --git a/toolkit/components/passwordmgr/nsLoginManager.js b/toolkit/components/passwordmgr/nsLoginManager.js
index 0db4933ddf49..ec505c1f6998 100644
--- a/toolkit/components/passwordmgr/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/nsLoginManager.js
@@ -88,6 +88,7 @@ LoginManager.prototype = {
     this._prefBranch.addObserver("rememberSignons", this._observer, false);
 
     this._remember = this._prefBranch.getBoolPref("rememberSignons");
+    this._autoCompleteLookupPromise = null;
 
     // Form submit observer checks forms for new logins and pw changes.
     Services.obs.addObserver(this._observer, "xpcom-shutdown", false);
@@ -461,14 +462,26 @@ LoginManager.prototype = {
     }
 
     let rect = BrowserUtils.getElementBoundingScreenRect(aElement);
-    LoginManagerContent._autoCompleteSearchAsync(aSearchString, previousResult,
-                                                 aElement, rect)
-                       .then(function({ logins, messageManager }) {
-                         let results =
-                             new UserAutoCompleteResult(aSearchString, logins, messageManager);
-                         aCallback.onSearchCompletion(results);
-                       })
-                       .then(null, Cu.reportError);
+    let autoCompleteLookupPromise = this._autoCompleteLookupPromise =
+      LoginManagerContent._autoCompleteSearchAsync(aSearchString, previousResult,
+                                                   aElement, rect);
+    autoCompleteLookupPromise.then(({ logins, messageManager }) => {
+                               // If the search was canceled before we got our
+                               // results, don't bother reporting them.
+                               if (this._autoCompleteLookupPromise !== autoCompleteLookupPromise) {
+                                 return;
+                               }
+
+                               this._autoCompleteLookupPromise = null;
+                               let results =
+                                 new UserAutoCompleteResult(aSearchString, logins, messageManager);
+                               aCallback.onSearchCompletion(results);
+                             })
+                            .then(null, Cu.reportError);
+  },
+
+  stopSearch() {
+    this._autoCompleteLookupPromise = null;
   },
 }; // end of LoginManager implementation
 
diff --git a/toolkit/components/satchel/nsFormFillController.cpp b/toolkit/components/satchel/nsFormFillController.cpp
index 2dd1d4acfdd5..9a4a059fa626 100644
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -774,6 +774,8 @@ nsFormFillController::StopSearch()
   if (mLastFormAutoComplete) {
     mLastFormAutoComplete->StopAutoCompleteSearch();
     mLastFormAutoComplete = nullptr;
+  } else if (mLoginManager) {
+    mLoginManager->StopSearch();
   }
   return NS_OK;
 }

From 25fd6bca14dccb5e374ef94c3abbdf7af1a5d23f Mon Sep 17 00:00:00 2001
From: Cameron McCormack 
Date: Tue, 19 Apr 2016 09:51:15 +1000
Subject: [PATCH 36/93] Bug 1264830 - Part 1: Add an nsStyleAutoArray array
 type, similar to AutoTArray<...,1> but memmovable. r=bholley

Existing uses of AutoTArray in style structs makes them non-memmovable.
We introduce this AutoTArray-alike class for use by those style struct
members that really do need to use an auto array's built-in allocation.
---
 layout/style/nsStyleStruct.h | 59 ++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h
index d698bfd38142..faae8dee8427 100644
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -453,6 +453,65 @@ struct nsStyleColor
   nscolor mColor;                 // [inherited]
 };
 
+/**
+ * An array of objects, similar to AutoTArray but which is memmovable. It
+ * always has length >= 1.
+ */
+template
+class nsStyleAutoArray
+{
+public:
+  // This constructor places a single element in mFirstElement.
+  enum WithSingleInitialElement { WITH_SINGLE_INITIAL_ELEMENT };
+  explicit nsStyleAutoArray(WithSingleInitialElement) {}
+  nsStyleAutoArray(const nsStyleAutoArray& aOther) { *this = aOther; }
+  nsStyleAutoArray& operator=(const nsStyleAutoArray& aOther) {
+    mFirstElement = aOther.mFirstElement;
+    mOtherElements = aOther.mOtherElements;
+    return *this;
+  }
+
+  bool operator==(const nsStyleAutoArray& aOther) const {
+    return Length() == aOther.Length() &&
+           mFirstElement == aOther.mFirstElement &&
+           mOtherElements == aOther.mOtherElements;
+  }
+  bool operator!=(const nsStyleAutoArray& aOther) const {
+    return !(*this == aOther);
+  }
+
+  size_t Length() const {
+    return mOtherElements.Length() + 1;
+  }
+  const T& operator[](size_t aIndex) const {
+    return aIndex == 0 ? mFirstElement : mOtherElements[aIndex - 1];
+  }
+  T& operator[](size_t aIndex) {
+    return aIndex == 0 ? mFirstElement : mOtherElements[aIndex - 1];
+  }
+
+  void EnsureLengthAtLeast(size_t aMinLen) {
+    if (aMinLen > 0) {
+      mOtherElements.EnsureLengthAtLeast(aMinLen - 1);
+    }
+  }
+
+  void SetLengthNonZero(size_t aNewLen) {
+    MOZ_ASSERT(aNewLen > 0);
+    mOtherElements.SetLength(aNewLen - 1);
+  }
+
+  void TruncateLengthNonZero(size_t aNewLen) {
+    MOZ_ASSERT(aNewLen > 0);
+    MOZ_ASSERT(aNewLen <= Length());
+    mOtherElements.TruncateLength(aNewLen - 1);
+  }
+
+private:
+  T mFirstElement;
+  nsTArray mOtherElements;
+};
+
 struct nsStyleImageLayers {
   nsStyleImageLayers();
   nsStyleImageLayers(const nsStyleImageLayers &aSource);

From e7ae67f8251272ae8278b657e18e76fe02e3584b Mon Sep 17 00:00:00 2001
From: Cameron McCormack 
Date: Tue, 19 Apr 2016 09:51:16 +1000
Subject: [PATCH 37/93] Bug 1264830 - Part 2: Change
 nsStyleImageLayers::mLayers to use nsStyleAutoArray. r=bholley

nsStyleImageLayers::mLayers always has at least one element in it, so we
change it to use nsStyleAutoArray rather than nsTArray.
---
 layout/style/nsRuleNode.cpp    | 16 ++++++++--------
 layout/style/nsStyleStruct.cpp |  3 +--
 layout/style/nsStyleStruct.h   |  2 +-
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp
index c57bbe04ede6..8cf2e303e129 100644
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -6725,8 +6725,8 @@ template 
 static void
 SetImageLayerList(nsStyleContext* aStyleContext,
                   const nsCSSValue& aValue,
-                  AutoTArray< nsStyleImageLayers::Layer, 1> &aLayers,
-                  const AutoTArray &aParentLayers,
+                  nsStyleAutoArray& aLayers,
+                  const nsStyleAutoArray& aParentLayers,
                   ComputedValueItem nsStyleImageLayers::Layer::* aResultLocation,
                   ComputedValueItem aInitialValue,
                   uint32_t aParentItemCount,
@@ -6790,9 +6790,8 @@ template 
 static void
 SetImageLayerPairList(nsStyleContext* aStyleContext,
                       const nsCSSValue& aValue,
-                      AutoTArray< nsStyleImageLayers::Layer, 1> &aLayers,
-                      const AutoTArray
-                                                                 &aParentLayers,
+                      nsStyleAutoArray& aLayers,
+                      const nsStyleAutoArray& aParentLayers,
                       ComputedValueItem nsStyleImageLayers::Layer::*
                                                                 aResultLocation,
                       ComputedValueItem aInitialValue,
@@ -6857,7 +6856,8 @@ SetImageLayerPairList(nsStyleContext* aStyleContext,
 
 template 
 static void
-FillBackgroundList(AutoTArray< nsStyleImageLayers::Layer, 1> &aLayers,
+FillBackgroundList(
+    nsStyleAutoArray& aLayers,
     ComputedValueItem nsStyleImageLayers::Layer::* aResultLocation,
     uint32_t aItemCount, uint32_t aFillCount)
 {
@@ -6979,7 +6979,7 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct,
   if (rebuild) {
     // Delete any extra items.  We need to keep layers in which any
     // property was specified.
-    bg->mImage.mLayers.TruncateLength(maxItemCount);
+    bg->mImage.mLayers.TruncateLengthNonZero(maxItemCount);
 
     uint32_t fillCount = bg->mImage.mImageCount;
     FillBackgroundList(bg->mImage.mLayers,
@@ -9794,7 +9794,7 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
   if (rebuild) {
     // Delete any extra items.  We need to keep layers in which any
     // property was specified.
-    svgReset->mMask.mLayers.TruncateLength(maxItemCount);
+    svgReset->mMask.mLayers.TruncateLengthNonZero(maxItemCount);
 
     uint32_t fillCount = svgReset->mMask.mImageCount;
 
diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp
index 78dda85180b4..8994a5a54835 100644
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -2324,10 +2324,9 @@ nsStyleImageLayers::nsStyleImageLayers()
   , mMaskModeCount(1)
   , mBlendModeCount(1)
   , mCompositeCount(1)
+  , mLayers(nsStyleAutoArray::WITH_SINGLE_INITIAL_ELEMENT)
 {
   MOZ_COUNT_CTOR(nsStyleImageLayers);
-  mLayers.AppendElement();
-  NS_ASSERTION(mLayers.Length() == 1, "auto array must have room for 1 element");
 }
 
 nsStyleImageLayers::nsStyleImageLayers(const nsStyleImageLayers &aSource)
diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h
index faae8dee8427..8c489fd4e0fc 100644
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -752,7 +752,7 @@ struct nsStyleImageLayers {
   // layer.  In layers below the bottom layer, properties will be
   // uninitialized unless their count, above, indicates that they are
   // present.
-  AutoTArray mLayers;
+  nsStyleAutoArray mLayers;
 
   const Layer& BottomLayer() const { return mLayers[mImageCount - 1]; }
 

From ce928d01ad5753698433c4cf82e791c5841948b9 Mon Sep 17 00:00:00 2001
From: Cameron McCormack 
Date: Tue, 19 Apr 2016 09:51:16 +1000
Subject: [PATCH 38/93] Bug 1264830 - Part 3: Change
 nsStyleDisplay::{mTransitions,mAnimations} to use nsStyleAutoArray. r=bholley

nsStyleDisplay::{mTransitions,mAnimations} both always have at least one
element in it, so we change them to use nsStyleAutoArray rather than
nsTArray.
---
 layout/style/nsRuleNode.cpp    | 4 ++--
 layout/style/nsStyleStruct.cpp | 8 ++------
 layout/style/nsStyleStruct.h   | 4 ++--
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp
index 8cf2e303e129..933d61cfa57e 100644
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -5261,7 +5261,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
                          display, parentDisplay, aRuleData,
                          conditions);
 
-  display->mTransitions.SetLength(numTransitions);
+  display->mTransitions.SetLengthNonZero(numTransitions);
 
   FOR_ALL_TRANSITION_PROPS(p) {
     const TransitionPropInfo& i = transitionPropInfo[p];
@@ -5418,7 +5418,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
                          display, parentDisplay, aRuleData,
                          conditions);
 
-  display->mAnimations.SetLength(numAnimations);
+  display->mAnimations.SetLengthNonZero(numAnimations);
 
   FOR_ALL_ANIMATION_PROPS(p) {
     const TransitionPropInfo& i = animationPropInfo[p];
diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp
index 8994a5a54835..f6bba18b553f 100644
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -2844,6 +2844,8 @@ mozilla::StyleAnimation::operator==(const mozilla::StyleAnimation& aOther) const
 
 nsStyleDisplay::nsStyleDisplay(StyleStructContext aContext)
   : mWillChangeBitField(0)
+  , mTransitions(nsStyleAutoArray::WITH_SINGLE_INITIAL_ELEMENT)
+  , mAnimations(nsStyleAutoArray::WITH_SINGLE_INITIAL_ELEMENT)
 {
   MOZ_COUNT_CTOR(nsStyleDisplay);
   mAppearance = NS_THEME_NONE;
@@ -2884,18 +2886,12 @@ nsStyleDisplay::nsStyleDisplay(StyleStructContext aContext)
   // Initial value for mScrollSnapDestination is "0px 0px"
   mScrollSnapDestination.SetInitialZeroValues();
 
-  mTransitions.AppendElement();
-  MOZ_ASSERT(mTransitions.Length() == 1,
-             "appending within auto buffer should never fail");
   mTransitions[0].SetInitialValues();
   mTransitionTimingFunctionCount = 1;
   mTransitionDurationCount = 1;
   mTransitionDelayCount = 1;
   mTransitionPropertyCount = 1;
 
-  mAnimations.AppendElement();
-  MOZ_ASSERT(mAnimations.Length() == 1,
-             "appending within auto buffer should never fail");
   mAnimations[0].SetInitialValues();
   mAnimationTimingFunctionCount = 1;
   mAnimationDurationCount = 1;
diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h
index 8c489fd4e0fc..a6d0c7fd9a67 100644
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -2575,7 +2575,7 @@ struct nsStyleDisplay
 
   nsStyleCoord mVerticalAlign;  // [reset] coord, percent, calc, enum (see nsStyleConsts.h)
 
-  AutoTArray mTransitions; // [reset]
+  nsStyleAutoArray mTransitions; // [reset]
   // The number of elements in mTransitions that are not from repeating
   // a list due to another property being longer.
   uint32_t mTransitionTimingFunctionCount,
@@ -2583,7 +2583,7 @@ struct nsStyleDisplay
            mTransitionDelayCount,
            mTransitionPropertyCount;
 
-  AutoTArray mAnimations; // [reset]
+  nsStyleAutoArray mAnimations; // [reset]
   // The number of elements in mAnimations that are not from repeating
   // a list due to another property being longer.
   uint32_t mAnimationTimingFunctionCount,

From 3e8238a0707b5e77e47cf8ddc85a2ab547a18a14 Mon Sep 17 00:00:00 2001
From: Cameron McCormack 
Date: Tue, 19 Apr 2016 09:51:16 +1000
Subject: [PATCH 39/93] Bug 1264830 - Part 4: Change
 nsStyleDisplay::mWillChange to use nsTArray. r=bholley

The initial value of nsStyleDisplay::mWillChange is represented by an
empty array, and will-change is not so common, so we change it to use an
nsTArray.
---
 layout/style/nsStyleStruct.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h
index a6d0c7fd9a67..1a957db67ed1 100644
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -2550,7 +2550,7 @@ struct nsStyleDisplay
                                 // match mWillChange. Also tracks if any of the
                                 // properties in the will-change list require
                                 // a stacking context.
-  AutoTArray mWillChange;
+  nsTArray mWillChange;
 
   uint8_t mTouchAction;         // [reset] see nsStyleConsts.h
   uint8_t mScrollBehavior;      // [reset] see nsStyleConsts.h NS_STYLE_SCROLL_BEHAVIOR_*

From e5525cb6d8bcf095d1ee7b643f1a8b727d71fdbe Mon Sep 17 00:00:00 2001
From: Cameron McCormack 
Date: Tue, 19 Apr 2016 09:51:16 +1000
Subject: [PATCH 40/93] Bug 1264830 - Part 5: Require all style structs be
 memmovable. r=bholley

---
 layout/style/nsStyleStruct.h | 48 ++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h
index 1a957db67ed1..f64fe048f8f5 100644
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -150,7 +150,7 @@ static_assert(offsetof(nsRect_Simple, width) == offsetof(nsRect, width), "Wrong
 static_assert(offsetof(nsRect_Simple, height) == offsetof(nsRect, height), "Wrong nsRect_Simple member alignment");
 
 // The lifetime of these objects is managed by the presshell's arena.
-struct nsStyleFont
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont
 {
   nsStyleFont(const nsFont& aFont, StyleStructContext aContext);
   nsStyleFont(const nsStyleFont& aStyleFont);
@@ -419,7 +419,7 @@ private:
 #endif
 };
 
-struct nsStyleColor
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColor
 {
   explicit nsStyleColor(StyleStructContext aContext);
   nsStyleColor(const nsStyleColor& aOther);
@@ -781,7 +781,7 @@ struct nsStyleImageLayers {
     for (uint32_t var_ = (start_) + 1; var_-- != (uint32_t)((start_) + 1 - (count_)); )
 };
 
-struct nsStyleBackground {
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBackground {
   explicit nsStyleBackground(StyleStructContext aContext);
   nsStyleBackground(const nsStyleBackground& aOther);
   ~nsStyleBackground();
@@ -834,7 +834,7 @@ struct nsStyleBackground {
 #define NS_SPACING_BORDER   2
 
 
-struct nsStyleMargin
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleMargin
 {
   explicit nsStyleMargin(StyleStructContext aContext);
   nsStyleMargin(const nsStyleMargin& aMargin);
@@ -880,7 +880,7 @@ protected:
 };
 
 
-struct nsStylePadding
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePadding
 {
   explicit nsStylePadding(StyleStructContext aContext);
   nsStylePadding(const nsStylePadding& aPadding);
@@ -1083,7 +1083,7 @@ static bool IsVisibleBorderStyle(uint8_t aStyle)
           aStyle != NS_STYLE_BORDER_STYLE_HIDDEN);
 }
 
-struct nsStyleBorder
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder
 {
   explicit nsStyleBorder(StyleStructContext aContext);
   nsStyleBorder(const nsStyleBorder& aBorder);
@@ -1310,7 +1310,7 @@ private:
 };
 
 
-struct nsStyleOutline
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleOutline
 {
   explicit nsStyleOutline(StyleStructContext aContext);
   nsStyleOutline(const nsStyleOutline& aOutline);
@@ -1426,7 +1426,7 @@ private:
   ~nsStyleQuoteValues() {}
 };
 
-struct nsStyleList
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleList
 {
   explicit nsStyleList(StyleStructContext aContext);
   nsStyleList(const nsStyleList& aStyleList);
@@ -1652,7 +1652,7 @@ struct nsStyleGridTemplate
   }
 };
 
-struct nsStylePosition
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePosition
 {
   explicit nsStylePosition(StyleStructContext aContext);
   nsStylePosition(const nsStylePosition& aOther);
@@ -1903,7 +1903,7 @@ struct nsStyleTextOverflow
   bool mLogicalDirections;  // true when only one value was specified
 };
 
-struct nsStyleTextReset
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTextReset
 {
   explicit nsStyleTextReset(StyleStructContext aContext);
   nsStyleTextReset(const nsStyleTextReset& aOther);
@@ -1988,7 +1988,7 @@ protected:
   nscolor mTextDecorationColor;         // [reset] the colors to use for a decoration lines, not used at currentColor
 };
 
-struct nsStyleText
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText
 {
   explicit nsStyleText(StyleStructContext aContext);
   nsStyleText(const nsStyleText& aOther);
@@ -2198,7 +2198,7 @@ protected:
   uint8_t mOrientation;
 };
 
-struct nsStyleVisibility
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility
 {
   explicit nsStyleVisibility(StyleStructContext aContext);
   nsStyleVisibility(const nsStyleVisibility& aVisibility);
@@ -2479,7 +2479,7 @@ private:
 
 } // namespace mozilla
 
-struct nsStyleDisplay
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay
 {
   explicit nsStyleDisplay(StyleStructContext aContext);
   nsStyleDisplay(const nsStyleDisplay& aOther);
@@ -2751,7 +2751,7 @@ struct nsStyleDisplay
   inline uint8_t PhysicalBreakType(mozilla::WritingMode aWM) const;
 };
 
-struct nsStyleTable
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTable
 {
   explicit nsStyleTable(StyleStructContext aContext);
   nsStyleTable(const nsStyleTable& aOther);
@@ -2784,7 +2784,7 @@ struct nsStyleTable
   int32_t       mSpan;          // [reset] the number of columns spanned by a colgroup or col
 };
 
-struct nsStyleTableBorder
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTableBorder
 {
   explicit nsStyleTableBorder(StyleStructContext aContext);
   nsStyleTableBorder(const nsStyleTableBorder& aOther);
@@ -2884,7 +2884,7 @@ struct nsStyleCounterData
 
 #define DELETE_ARRAY_IF(array)  if (array) { delete[] array; array = nullptr; }
 
-struct nsStyleContent
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleContent
 {
   explicit nsStyleContent(StyleStructContext aContext);
   nsStyleContent(const nsStyleContent& aContent);
@@ -2995,7 +2995,7 @@ protected:
   uint32_t            mResetCount;
 };
 
-struct nsStyleUIReset
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset
 {
   explicit nsStyleUIReset(StyleStructContext aContext);
   nsStyleUIReset(const nsStyleUIReset& aOther);
@@ -3061,7 +3061,7 @@ private:
   nsCOMPtr mImage;
 };
 
-struct nsStyleUserInterface
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUserInterface
 {
   explicit nsStyleUserInterface(StyleStructContext aContext);
   nsStyleUserInterface(const nsStyleUserInterface& aOther);
@@ -3112,7 +3112,7 @@ struct nsStyleUserInterface
   inline uint8_t GetEffectivePointerEvents(nsIFrame* aFrame) const;
 };
 
-struct nsStyleXUL
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleXUL
 {
   explicit nsStyleXUL(StyleStructContext aContext);
   nsStyleXUL(const nsStyleXUL& aSource);
@@ -3150,7 +3150,7 @@ struct nsStyleXUL
   bool          mStretchStack;          // [reset] see nsStyleConsts.h
 };
 
-struct nsStyleColumn
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColumn
 {
   explicit nsStyleColumn(StyleStructContext aContext);
   nsStyleColumn(const nsStyleColumn& aSource);
@@ -3245,7 +3245,7 @@ struct nsStyleSVGPaint
   }
 };
 
-struct nsStyleSVG
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG
 {
   explicit nsStyleSVG(StyleStructContext aContext);
   nsStyleSVG(const nsStyleSVG& aSource);
@@ -3531,7 +3531,7 @@ struct nsTArray_CopyChooser
   typedef nsTArray_CopyWithConstructors Type;
 };
 
-struct nsStyleSVGReset
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVGReset
 {
   explicit nsStyleSVGReset(StyleStructContext aContext);
   nsStyleSVGReset(const nsStyleSVGReset& aSource);
@@ -3581,7 +3581,7 @@ struct nsStyleSVGReset
   uint8_t          mMaskType;         // [reset] see nsStyleConsts.h
 };
 
-struct nsStyleVariables
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVariables
 {
   explicit nsStyleVariables(StyleStructContext aContext);
   nsStyleVariables(const nsStyleVariables& aSource);
@@ -3611,7 +3611,7 @@ struct nsStyleVariables
   mozilla::CSSVariableValues mVariables;
 };
 
-struct nsStyleEffects
+struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleEffects
 {
   explicit nsStyleEffects(StyleStructContext aContext);
   nsStyleEffects(const nsStyleEffects& aSource);

From 7d381d9383ef5087831e433ebb794ebee9b64aa8 Mon Sep 17 00:00:00 2001
From: JW Wang 
Date: Mon, 18 Apr 2016 15:39:15 +0800
Subject: [PATCH 41/93] Bug 1265296 - Move SeekTask from namespace
 mozilla::media to namespace mozilla. r=kaku.

MozReview-Commit-ID: 2bfgaqahchu
---
 dom/media/MediaDecoderStateMachine.h | 8 ++++----
 dom/media/SeekTask.cpp               | 3 ---
 dom/media/SeekTask.h                 | 3 ---
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h
index e32f29316541..428a67196876 100644
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -688,11 +688,11 @@ private:
   SeekJob mQueuedSeek;
 
   // mSeekTask is responsible for executing the current seek request.
-  RefPtr mSeekTask;
-  MozPromiseRequestHolder mSeekTaskRequest;
+  RefPtr mSeekTask;
+  MozPromiseRequestHolder mSeekTaskRequest;
 
-  void OnSeekTaskResolved(media::SeekTaskResolveValue aValue);
-  void OnSeekTaskRejected(media::SeekTaskRejectValue aValue);
+  void OnSeekTaskResolved(SeekTaskResolveValue aValue);
+  void OnSeekTaskRejected(SeekTaskRejectValue aValue);
 
   // Media Fragment end time in microseconds. Access controlled by decoder monitor.
   int64_t mFragmentEndTime;
diff --git a/dom/media/SeekTask.cpp b/dom/media/SeekTask.cpp
index 72108b9101c6..1d1b0865401c 100644
--- a/dom/media/SeekTask.cpp
+++ b/dom/media/SeekTask.cpp
@@ -35,8 +35,6 @@ extern LazyLogModule gMediaSampleLog;
 #define DECODER_WARN(x, ...) \
   DECODER_WARN_HELPER(0, (nsPrintfCString("Decoder=%p " x, mDecoderID, ##__VA_ARGS__).get()))
 
-namespace media {
-
 /*static*/ already_AddRefed
 SeekTask::CreateSeekTask(const void* aDecoderID,
                          AbstractThread* aThread,
@@ -725,5 +723,4 @@ SeekTask::OnVideoNotDecoded(MediaDecoderReader::NotDecodedReason aReason)
   }
 }
 
-} // namespace media
 } // namespace mozilla
diff --git a/dom/media/SeekTask.h b/dom/media/SeekTask.h
index 2158b0886fc8..979f6173144c 100644
--- a/dom/media/SeekTask.h
+++ b/dom/media/SeekTask.h
@@ -17,8 +17,6 @@ class AbstractThread;
 class MediaData;
 class MediaDecoderReaderWrapper;
 
-namespace media {
-
 struct SeekTaskResolveValue
 {
   RefPtr mSeekedAudioData;
@@ -178,7 +176,6 @@ protected:
   bool mNeedToStopPrerollingVideo;
 };
 
-} // namespace media
 } // namespace mozilla
 
 #endif /* SEEK_TASK_H */

From 50467e2954adb75933a0ea863c1a8a76eaed7047 Mon Sep 17 00:00:00 2001
From: Shawn Huang 
Date: Tue, 19 Apr 2016 10:32:43 +0800
Subject: [PATCH 42/93] Bug 1259588 - new File("") throws TypeError exception,
 r=baku

---
 dom/base/File.cpp                  |  2 +-
 dom/base/test/mochitest.ini        |  1 +
 dom/base/test/test_bug1259588.html | 13 +++++++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 dom/base/test/test_bug1259588.html

diff --git a/dom/base/File.cpp b/dom/base/File.cpp
index 92aef769879d..aa1c49e47cfc 100644
--- a/dom/base/File.cpp
+++ b/dom/base/File.cpp
@@ -622,7 +622,7 @@ File::Constructor(const GlobalObject& aGlobal,
                   ErrorResult& aRv)
 {
   if (!nsContentUtils::ThreadsafeIsCallerChrome()) {
-    aRv.Throw(NS_ERROR_FAILURE);
+    aRv.ThrowTypeError(NS_LITERAL_STRING("File"));
     return nullptr;
   }
 
diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini
index ede399a5682c..781c8b432a49 100644
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -893,3 +893,4 @@ skip-if = buildapp == 'b2g' #no ssl support
 [test_mozbrowser_apis_blocked.html]
 [test_document_register.html]
 [test_bug962251.html]
+[test_bug1259588.html]
diff --git a/dom/base/test/test_bug1259588.html b/dom/base/test/test_bug1259588.html
new file mode 100644
index 000000000000..40a272f90542
--- /dev/null
+++ b/dom/base/test/test_bug1259588.html
@@ -0,0 +1,13 @@
+
+
+Test for Bug 1259588
+
+
+
+ From 721e1c8aaf224aa66bdc0186d95bf33e37156fec Mon Sep 17 00:00:00 2001 From: Maja Frydrychowicz Date: Mon, 18 Apr 2016 15:33:43 -0400 Subject: [PATCH 43/93] Bug 1263425 - Include crashes in Marionette runner's error/failure count; r=automatedtester This addresses the case where there is a crash immediately after a passing test, in which case the test suite stops and no failure is recorded. MozReview-Commit-ID: LDzQfQX5NZQ --HG-- extra : rebase_source : b96d610797fde31a6351407331d294385b9aaf5c --- .../harness/marionette/runner/base.py | 22 ++- .../marionette/harness/marionette/runtests.py | 2 +- .../harness_unit/test_marionette_runner.py | 153 ++++++++++++++---- 3 files changed, 143 insertions(+), 34 deletions(-) diff --git a/testing/marionette/harness/marionette/runner/base.py b/testing/marionette/harness/marionette/runner/base.py index 642d80434862..be5c38f9896c 100644 --- a/testing/marionette/harness/marionette/runner/base.py +++ b/testing/marionette/harness/marionette/runner/base.py @@ -215,6 +215,10 @@ class MarionetteTestResult(StructuredTestResult, TestResultCollection): if self.marionette.check_for_crash(): # this tells unittest.TestSuite not to continue running tests self.shouldStop = True + test = next((a for a in args if isinstance(a, unittest.TestCase)), + None) + if test: + self.addError(test, sys.exc_info()) class MarionetteTextTestRunner(StructuredTestRunner): @@ -739,6 +743,7 @@ class BaseMarionetteTestRunner(object): def reset_test_stats(self): self.passed = 0 self.failed = 0 + self.crashed = 0 self.unexpected_successes = 0 self.todo = 0 self.skipped = 0 @@ -857,6 +862,15 @@ setReq.onerror = function() { if not result: raise Exception("Could not launch test container app") + def record_crash(self): + crash = True + try: + crash = self.marionette.check_for_crash() + self.crashed += int(crash) + except Exception: + traceback.print_exc() + return crash + def run_tests(self, tests): assert len(tests) > 0 assert len(self.test_handlers) > 0 @@ -969,11 +983,7 @@ setReq.onerror = function() { for failed_test in self.failures: self.logger.info('%s' % failed_test[0]) - try: - self.marionette.check_for_crash() - except: - traceback.print_exc() - + self.record_crash() self.end_time = time.time() self.elapsedtime = self.end_time - self.start_time @@ -1140,7 +1150,7 @@ setReq.onerror = function() { for test in tests: self.run_test(test['filepath'], test['expected'], test['test_container']) - if self.marionette.check_for_crash(): + if self.record_crash(): break def run_test_sets(self): diff --git a/testing/marionette/harness/marionette/runtests.py b/testing/marionette/harness/marionette/runtests.py index 762615d5db99..66d8ae6c0ef9 100644 --- a/testing/marionette/harness/marionette/runtests.py +++ b/testing/marionette/harness/marionette/runtests.py @@ -65,7 +65,7 @@ class MarionetteHarness(object): tests = self.args.pop('tests') runner = self._runner_class(**self.args) runner.run_tests(tests) - return runner.failed + return runner.failed + runner.crashed except Exception: logger = self.args.get('logger') if logger: diff --git a/testing/marionette/harness/marionette/tests/harness_unit/test_marionette_runner.py b/testing/marionette/harness/marionette/tests/harness_unit/test_marionette_runner.py index 269eb20385ea..a97c717c805e 100644 --- a/testing/marionette/harness/marionette/tests/harness_unit/test_marionette_runner.py +++ b/testing/marionette/harness/marionette/tests/harness_unit/test_marionette_runner.py @@ -2,18 +2,55 @@ # 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/. import pytest -from mock import patch, Mock +from mock import patch, Mock, DEFAULT from marionette.runtests import ( MarionetteTestRunner, MarionetteHarness, cli ) +from marionette.runner import MarionetteTestResult # avoid importing MarionetteJSTestCase to prevent pytest from # collecting and running it as part of this test suite import marionette.marionette_test as marionette_test + +def _check_crash_counts(has_crashed, runner, mock_marionette): + if has_crashed: + assert mock_marionette.check_for_crash.call_count == 1 + assert runner.crashed == 1 + else: + assert runner.crashed == 0 + + +@pytest.fixture() +def mock_marionette(request): + """ Mock marionette instance """ + import marionette_driver + marionette = Mock(spec=marionette_driver.marionette.Marionette) + if 'has_crashed' in request.funcargnames: + marionette.check_for_crash.return_value = request.getfuncargvalue( + 'has_crashed' + ) + return marionette + + +@pytest.fixture() +def empty_marionette_testcase(): + """ Testable MarionetteTestCase class """ + class EmptyTestCase(marionette_test.MarionetteTestCase): + def test_nothing(self): + pass + + return EmptyTestCase + + +@pytest.fixture() +def empty_marionette_test(mock_marionette, empty_marionette_testcase): + return empty_marionette_testcase(lambda: mock_marionette, 'test_nothing') + + @pytest.fixture(scope='module') def logger(): """ @@ -91,6 +128,13 @@ def mach_parsed_kwargs(logger): } +@pytest.fixture() +def runner(mach_parsed_kwargs): + """ + MarionetteTestRunner instance initialized with default options. + """ + return MarionetteTestRunner(**mach_parsed_kwargs) + @pytest.fixture def harness_class(request): @@ -98,61 +142,68 @@ def harness_class(request): Mock based on MarionetteHarness whose run method just returns a number of failures according to the supplied test parameter """ - if 'num_failures' in request.funcargnames: - failures = request.getfuncargvalue('num_failures') + if 'num_fails_crashed' in request.funcargnames: + num_fails_crashed = request.getfuncargvalue('num_fails_crashed') else: - failures = 0 + num_fails_crashed = (0, 0) harness_cls = Mock(spec=MarionetteHarness) harness = harness_cls.return_value - if failures is None: + if num_fails_crashed is None: harness.run.side_effect = Exception else: - harness.run.return_value = failures + harness.run.return_value = sum(num_fails_crashed) return harness_cls @pytest.fixture def runner_class(request): """ - Mock based on MarionetteTestRunner, wherein the runner.failed - attribute is provided by a test parameter + Mock based on MarionetteTestRunner, wherein the runner.failed, + runner.crashed attributes are provided by a test parameter """ - if 'num_failures' in request.funcargnames: - failures = request.getfuncargvalue('num_failures') + if 'num_fails_crashed' in request.funcargnames: + failures, crashed = request.getfuncargvalue('num_fails_crashed') else: failures = 0 + crashed = 0 mock_runner_class = Mock(spec=MarionetteTestRunner) runner = mock_runner_class.return_value runner.failed = failures + runner.crashed = crashed return mock_runner_class @pytest.mark.parametrize( - "num_failures,exit_code", - [(0, 0), (1, 10), (None, 1)], + "num_fails_crashed,exit_code", + [((0, 0), 0), ((1, 0), 10), ((0, 1), 10), (None, 1)], ) -def test_cli_exit_code(num_failures, exit_code, harness_class): +def test_cli_exit_code(num_fails_crashed, exit_code, harness_class): with pytest.raises(SystemExit) as err: cli(harness_class=harness_class) assert err.value.code == exit_code -@pytest.mark.parametrize("num_failures", [0, 1]) +@pytest.mark.parametrize("num_fails_crashed", [(0, 0), (1, 0), (1, 1)]) def test_call_harness_with_parsed_args_yields_num_failures(mach_parsed_kwargs, runner_class, - num_failures): - with patch('marionette.runtests.MarionetteHarness.parse_args') as parse_args: - failed = MarionetteHarness(runner_class, args=mach_parsed_kwargs).run() + num_fails_crashed): + with patch( + 'marionette.runtests.MarionetteHarness.parse_args' + ) as parse_args: + failed_or_crashed = MarionetteHarness(runner_class, + args=mach_parsed_kwargs).run() parse_args.assert_not_called() - assert failed == num_failures + assert failed_or_crashed == sum(num_fails_crashed) def test_call_harness_with_no_args_yields_num_failures(runner_class): - with patch('marionette.runtests.MarionetteHarness.parse_args') as parse_args: - parse_args.return_value = {'tests':[]} - failed = MarionetteHarness(runner_class).run() + with patch( + 'marionette.runtests.MarionetteHarness.parse_args' + ) as parse_args: + parse_args.return_value = {'tests': []} + failed_or_crashed = MarionetteHarness(runner_class).run() assert parse_args.call_count == 1 - assert failed == 0 + assert failed_or_crashed == 0 def test_harness_sets_up_default_test_handlers(mach_parsed_kwargs): @@ -170,24 +221,72 @@ def test_harness_sets_up_default_test_handlers(mach_parsed_kwargs): def test_parsing_testvars(mach_parsed_kwargs): mach_parsed_kwargs.pop('tests') testvars_json_loads = [ - {"wifi":{"ssid": "blah", "keyManagement": "WPA-PSK", "psk": "foo"}}, - {"wifi":{"PEAP": "bar"}, "device": {"stuff": "buzz"}} + {"wifi": {"ssid": "blah", "keyManagement": "WPA-PSK", "psk": "foo"}}, + {"wifi": {"PEAP": "bar"}, "device": {"stuff": "buzz"}} ] expected_dict = { "wifi": { "ssid": "blah", "keyManagement": "WPA-PSK", "psk": "foo", - "PEAP":"bar" + "PEAP": "bar" }, - "device": {"stuff":"buzz"} + "device": {"stuff": "buzz"} } - with patch('marionette.runtests.MarionetteTestRunner._load_testvars') as load: + with patch( + 'marionette.runtests.MarionetteTestRunner._load_testvars' + ) as load: load.return_value = testvars_json_loads runner = MarionetteTestRunner(**mach_parsed_kwargs) assert runner.testvars == expected_dict assert load.call_count == 1 + +@pytest.mark.parametrize("has_crashed", [True, False]) +def test_crash_is_recorded_as_error(empty_marionette_test, + logger, + has_crashed): + """ Number of errors is incremented by stopTest iff has_crashed is true """ + # collect results from the empty test + result = MarionetteTestResult( + marionette=empty_marionette_test._marionette_weakref(), + b2g_pid=0, logcat_stdout=False, logger=logger, verbosity=None, + stream=None, descriptions=None, + ) + result.startTest(empty_marionette_test) + assert len(result.errors) == 0 + assert len(result.failures) == 0 + assert result.testsRun == 1 + assert result.shouldStop == False + result.stopTest(empty_marionette_test) + assert result.shouldStop == has_crashed + if has_crashed: + assert len(result.errors) == 1 + else: + assert len(result.errors) == 0 + + +@pytest.mark.parametrize("has_crashed", [True, False]) +def test_increment_crash_count_in_run_test_set(runner, has_crashed, + mock_marionette): + fake_tests = [{'filepath': i, + 'expected': 'pass', + 'test_container': False} for i in 'abc'] + + with patch.multiple(runner, run_test=DEFAULT, marionette=mock_marionette): + runner.run_test_set(fake_tests) + if not has_crashed: + assert runner.marionette.check_for_crash.call_count == len(fake_tests) + _check_crash_counts(has_crashed, runner, runner.marionette) + + +@pytest.mark.parametrize("has_crashed", [True, False]) +def test_record_crash(runner, has_crashed, mock_marionette): + with patch.object(runner, 'marionette', mock_marionette): + assert runner.record_crash() == has_crashed + _check_crash_counts(has_crashed, runner, runner.marionette) + + if __name__ == '__main__': import sys sys.exit(pytest.main(['--verbose', __file__])) From 28664ebdb0a13259b570b796138e58d68302e0ec Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 16:26:44 +0800 Subject: [PATCH 44/93] Bug 1264837 Part 1 - Remove nsTextBoxFrameSuper. r=dholbert MozReview-Commit-ID: DFQ77kfvhrB --HG-- extra : rebase_source : b66b672d6f4266a61c46ba2bc2f05af8d8eba4bf --- layout/xul/nsTextBoxFrame.cpp | 8 ++++---- layout/xul/nsTextBoxFrame.h | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/layout/xul/nsTextBoxFrame.cpp b/layout/xul/nsTextBoxFrame.cpp index cf6143335f06..4ec575378a3b 100644 --- a/layout/xul/nsTextBoxFrame.cpp +++ b/layout/xul/nsTextBoxFrame.cpp @@ -68,7 +68,7 @@ NS_IMPL_FRAMEARENA_HELPERS(nsTextBoxFrame) NS_QUERYFRAME_HEAD(nsTextBoxFrame) NS_QUERYFRAME_ENTRY(nsTextBoxFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsTextBoxFrameSuper) +NS_QUERYFRAME_TAIL_INHERITING(nsLeafBoxFrame) nsresult nsTextBoxFrame::AttributeChanged(int32_t aNameSpaceID, @@ -115,7 +115,7 @@ nsTextBoxFrame::Init(nsIContent* aContent, nsContainerFrame* aParent, nsIFrame* aPrevInFlow) { - nsTextBoxFrameSuper::Init(aContent, aParent, aPrevInFlow); + nsLeafBoxFrame::Init(aContent, aParent, aPrevInFlow); bool aResize; bool aRedraw; @@ -130,7 +130,7 @@ nsTextBoxFrame::DestroyFrom(nsIFrame* aDestructRoot) { // unregister access key RegUnregAccessKey(false); - nsTextBoxFrameSuper::DestroyFrom(aDestructRoot); + nsLeafBoxFrame::DestroyFrom(aDestructRoot); } bool @@ -1021,7 +1021,7 @@ nsTextBoxFrame::ComputesOwnOverflowArea() nsTextBoxFrame::MarkIntrinsicISizesDirty() { mNeedsRecalc = true; - nsTextBoxFrameSuper::MarkIntrinsicISizesDirty(); + nsLeafBoxFrame::MarkIntrinsicISizesDirty(); } void diff --git a/layout/xul/nsTextBoxFrame.h b/layout/xul/nsTextBoxFrame.h index 6c7b92b9a076..adf63342e0af 100644 --- a/layout/xul/nsTextBoxFrame.h +++ b/layout/xul/nsTextBoxFrame.h @@ -12,8 +12,7 @@ class nsAccessKeyInfo; class nsAsyncAccesskeyUpdate; class nsFontMetrics; -typedef nsLeafBoxFrame nsTextBoxFrameSuper; -class nsTextBoxFrame : public nsTextBoxFrameSuper +class nsTextBoxFrame : public nsLeafBoxFrame { public: NS_DECL_QUERYFRAME_TARGET(nsTextBoxFrame) From 3209f075ece867f6132d41b2f3161418541a72ac Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 13:32:19 +0800 Subject: [PATCH 45/93] Bug 1264837 Part 2 - Remove nsColorControlFrameSuper. r=dholbert MozReview-Commit-ID: DKaroibsqfQ --HG-- extra : rebase_source : 4825b7eb4a5d02e0d510a3f0e76d7c06a1f9f9b2 --- layout/forms/nsColorControlFrame.cpp | 10 +++++----- layout/forms/nsColorControlFrame.h | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/layout/forms/nsColorControlFrame.cpp b/layout/forms/nsColorControlFrame.cpp index 9c0972dca59c..e0bae43a98bc 100644 --- a/layout/forms/nsColorControlFrame.cpp +++ b/layout/forms/nsColorControlFrame.cpp @@ -20,8 +20,8 @@ using mozilla::dom::Element; -nsColorControlFrame::nsColorControlFrame(nsStyleContext* aContext): - nsColorControlFrameSuper(aContext) +nsColorControlFrame::nsColorControlFrame(nsStyleContext* aContext) + : nsHTMLButtonControlFrame(aContext) { } @@ -36,14 +36,14 @@ NS_IMPL_FRAMEARENA_HELPERS(nsColorControlFrame) NS_QUERYFRAME_HEAD(nsColorControlFrame) NS_QUERYFRAME_ENTRY(nsColorControlFrame) NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) -NS_QUERYFRAME_TAIL_INHERITING(nsColorControlFrameSuper) +NS_QUERYFRAME_TAIL_INHERITING(nsHTMLButtonControlFrame) void nsColorControlFrame::DestroyFrom(nsIFrame* aDestructRoot) { nsFormControlFrame::RegUnRegAccessKey(static_cast(this), false); nsContentUtils::DestroyAnonymousContent(&mColorContent); - nsColorControlFrameSuper::DestroyFrom(aDestructRoot); + nsHTMLButtonControlFrame::DestroyFrom(aDestructRoot); } nsIAtom* @@ -126,7 +126,7 @@ nsColorControlFrame::AttributeChanged(int32_t aNameSpaceID, aNameSpaceID == kNameSpaceID_None && nsGkAtoms::value == aAttribute) { UpdateColor(); } - return nsColorControlFrameSuper::AttributeChanged(aNameSpaceID, aAttribute, + return nsHTMLButtonControlFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); } diff --git a/layout/forms/nsColorControlFrame.h b/layout/forms/nsColorControlFrame.h index 568485c033d7..238347ce3576 100644 --- a/layout/forms/nsColorControlFrame.h +++ b/layout/forms/nsColorControlFrame.h @@ -14,11 +14,9 @@ namespace mozilla { enum class CSSPseudoElementType : uint8_t; } // namespace mozilla -typedef nsHTMLButtonControlFrame nsColorControlFrameSuper; - // Class which implements the input type=color -class nsColorControlFrame final : public nsColorControlFrameSuper, +class nsColorControlFrame final : public nsHTMLButtonControlFrame, public nsIAnonymousContentCreator { typedef mozilla::CSSPseudoElementType CSSPseudoElementType; From 3c81554bc0422152cb990773acc0b9458089c7da Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 13:42:26 +0800 Subject: [PATCH 46/93] Bug 1264837 Part 3 - Remove nsFormControlFrameSuper. r=dholbert MozReview-Commit-ID: 4JTfaUgsVoA --HG-- extra : rebase_source : 0445b21d618b8b642080551fe87b3df92d3d7620 --- layout/forms/nsFormControlFrame.cpp | 10 +++++----- layout/forms/nsFormControlFrame.h | 14 ++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/layout/forms/nsFormControlFrame.cpp b/layout/forms/nsFormControlFrame.cpp index 436ade4bc2ef..75ce777fa861 100644 --- a/layout/forms/nsFormControlFrame.cpp +++ b/layout/forms/nsFormControlFrame.cpp @@ -17,8 +17,8 @@ using namespace mozilla; //#define FCF_NOISY -nsFormControlFrame::nsFormControlFrame(nsStyleContext* aContext) : - nsFormControlFrameSuper(aContext) +nsFormControlFrame::nsFormControlFrame(nsStyleContext* aContext) + : nsAtomicContainerFrame(aContext) { } @@ -29,7 +29,7 @@ nsFormControlFrame::~nsFormControlFrame() nsIAtom* nsFormControlFrame::GetType() const { - return nsGkAtoms::formControlFrame; + return nsGkAtoms::formControlFrame; } void @@ -37,12 +37,12 @@ nsFormControlFrame::DestroyFrom(nsIFrame* aDestructRoot) { // Unregister the access key registered in reflow nsFormControlFrame::RegUnRegAccessKey(static_cast(this), false); - nsFormControlFrameSuper::DestroyFrom(aDestructRoot); + nsAtomicContainerFrame::DestroyFrom(aDestructRoot); } NS_QUERYFRAME_HEAD(nsFormControlFrame) NS_QUERYFRAME_ENTRY(nsIFormControlFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsFormControlFrameSuper) +NS_QUERYFRAME_TAIL_INHERITING(nsAtomicContainerFrame) /* virtual */ nscoord nsFormControlFrame::GetMinISize(nsRenderingContext *aRenderingContext) diff --git a/layout/forms/nsFormControlFrame.h b/layout/forms/nsFormControlFrame.h index 9d3a3034bc32..9ca7909b92ec 100644 --- a/layout/forms/nsFormControlFrame.h +++ b/layout/forms/nsFormControlFrame.h @@ -11,14 +11,12 @@ #include "nsAtomicContainerFrame.h" #include "nsDisplayList.h" -typedef nsAtomicContainerFrame nsFormControlFrameSuper; - -/** +/** * nsFormControlFrame is the base class for radio buttons and * checkboxes. It also has two static methods (RegUnRegAccessKey and * GetScreenHeight) that are used by other form controls. */ -class nsFormControlFrame : public nsFormControlFrameSuper, +class nsFormControlFrame : public nsAtomicContainerFrame, public nsIFormControlFrame { public: @@ -33,7 +31,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return nsFormControlFrameSuper::IsFrameOfType(aFlags & + return nsAtomicContainerFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock)); } @@ -68,11 +66,11 @@ public: const mozilla::LogicalSize& aPadding, bool aShrinkWrap) override; - /** + /** * Respond to a gui event * @see nsIFrame::HandleEvent */ - virtual nsresult HandleEvent(nsPresContext* aPresContext, + virtual nsresult HandleEvent(nsPresContext* aPresContext, mozilla::WidgetGUIEvent* aEvent, nsEventStatus* aEventStatus) override; @@ -117,7 +115,7 @@ protected: //------------------------------------------------------------------------------------- // Utility methods for managing checkboxes and radiobuttons //------------------------------------------------------------------------------------- -// +// /** * Get the state of the checked attribute. * @param aState set to true if the checked attribute is set, From 0b4e2737183392379cd79d9d2fb31e248ac17d0d Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 13:47:53 +0800 Subject: [PATCH 47/93] Bug 1264837 Part 4 - Remove nsImageControlFrameSuper. r=dholbert MozReview-Commit-ID: 91A7PUWzsqH --HG-- extra : rebase_source : 4ddd8c73f34e5ae00982a6a238955ddcf081af63 --- layout/forms/nsImageControlFrame.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/layout/forms/nsImageControlFrame.cpp b/layout/forms/nsImageControlFrame.cpp index 02f6ce2ba254..589b4e7a9009 100644 --- a/layout/forms/nsImageControlFrame.cpp +++ b/layout/forms/nsImageControlFrame.cpp @@ -15,8 +15,7 @@ using namespace mozilla; -typedef nsImageFrame nsImageControlFrameSuper; -class nsImageControlFrame : public nsImageControlFrameSuper, +class nsImageControlFrame : public nsImageFrame, public nsIFormControlFrame { public: @@ -56,13 +55,13 @@ public: nsIFrame::Cursor& aCursor) override; // nsIFormContromFrame virtual void SetFocus(bool aOn, bool aRepaint) override; - virtual nsresult SetFormProperty(nsIAtom* aName, + virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) override; }; -nsImageControlFrame::nsImageControlFrame(nsStyleContext* aContext): - nsImageControlFrameSuper(aContext) +nsImageControlFrame::nsImageControlFrame(nsStyleContext* aContext) + : nsImageFrame(aContext) { } @@ -76,7 +75,7 @@ nsImageControlFrame::DestroyFrom(nsIFrame* aDestructRoot) if (!GetPrevInFlow()) { nsFormControlFrame::RegUnRegAccessKey(this, false); } - nsImageControlFrameSuper::DestroyFrom(aDestructRoot); + nsImageFrame::DestroyFrom(aDestructRoot); } nsIFrame* @@ -92,12 +91,12 @@ nsImageControlFrame::Init(nsIContent* aContent, nsContainerFrame* aParent, nsIFrame* aPrevInFlow) { - nsImageControlFrameSuper::Init(aContent, aParent, aPrevInFlow); + nsImageFrame::Init(aContent, aParent, aPrevInFlow); if (aPrevInFlow) { return; } - + mContent->SetProperty(nsGkAtoms::imageClickedPoint, new nsIntPoint(0, 0), nsINode::DeleteProperty); @@ -105,7 +104,7 @@ nsImageControlFrame::Init(nsIContent* aContent, NS_QUERYFRAME_HEAD(nsImageControlFrame) NS_QUERYFRAME_ENTRY(nsIFormControlFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsImageControlFrameSuper) +NS_QUERYFRAME_TAIL_INHERITING(nsImageFrame) #ifdef ACCESSIBILITY a11y::AccType @@ -122,7 +121,7 @@ nsImageControlFrame::AccessibleType() nsIAtom* nsImageControlFrame::GetType() const { - return nsGkAtoms::imageControlFrame; + return nsGkAtoms::imageControlFrame; } void @@ -136,10 +135,10 @@ nsImageControlFrame::Reflow(nsPresContext* aPresContext, if (!GetPrevInFlow() && (mState & NS_FRAME_FIRST_REFLOW)) { nsFormControlFrame::RegUnRegAccessKey(this, true); } - return nsImageControlFrameSuper::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); + return nsImageFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); } -nsresult +nsresult nsImageControlFrame::HandleEvent(nsPresContext* aPresContext, WidgetGUIEvent* aEvent, nsEventStatus* aEventStatus) @@ -175,11 +174,10 @@ nsImageControlFrame::HandleEvent(nsPresContext* aPresContext, TranslateEventCoords(pt, *lastClickPoint); } } - return nsImageControlFrameSuper::HandleEvent(aPresContext, aEvent, - aEventStatus); + return nsImageFrame::HandleEvent(aPresContext, aEvent, aEventStatus); } -void +void nsImageControlFrame::SetFocus(bool aOn, bool aRepaint) { } From b2197b464de3eb61a522bd3dbf42411874820c2f Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 13:51:36 +0800 Subject: [PATCH 48/93] Bug 1264837 Part 5 - Remove nsFlexContainerFrameSuper. r=dholbert MozReview-Commit-ID: 1PejkyMfn0V --HG-- extra : rebase_source : d8b63bd7f6fb064155eb40fa4b80f14e1f7f852a --- layout/generic/nsFlexContainerFrame.cpp | 2 +- layout/generic/nsFlexContainerFrame.h | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index 2d2dcd50236a..fecea291d2b1 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -2030,7 +2030,7 @@ public: NS_QUERYFRAME_HEAD(nsFlexContainerFrame) NS_QUERYFRAME_ENTRY(nsFlexContainerFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsFlexContainerFrameSuper) +NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame) NS_IMPL_FRAMEARENA_HELPERS(nsFlexContainerFrame) diff --git a/layout/generic/nsFlexContainerFrame.h b/layout/generic/nsFlexContainerFrame.h index ee24052c2cf8..12d6ca5f472b 100644 --- a/layout/generic/nsFlexContainerFrame.h +++ b/layout/generic/nsFlexContainerFrame.h @@ -20,9 +20,7 @@ class LogicalPoint; nsContainerFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); -typedef nsContainerFrame nsFlexContainerFrameSuper; - -class nsFlexContainerFrame : public nsFlexContainerFrameSuper { +class nsFlexContainerFrame : public nsContainerFrame { public: NS_DECL_FRAMEARENA_HELPERS NS_DECL_QUERYFRAME_TARGET(nsFlexContainerFrame) @@ -62,8 +60,8 @@ public: protected: // Protected constructor & destructor - explicit nsFlexContainerFrame(nsStyleContext* aContext) : - nsFlexContainerFrameSuper(aContext) + explicit nsFlexContainerFrame(nsStyleContext* aContext) + : nsContainerFrame(aContext) {} virtual ~nsFlexContainerFrame(); From 073a472d9529b43f925f25cbef7b67dcf63f18ea Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 13:58:30 +0800 Subject: [PATCH 49/93] Bug 1264837 Part 6 - Remove ImageFrameSuper. r=dholbert MozReview-Commit-ID: ujNsOONTzI --HG-- extra : rebase_source : ac9cc91be85acf1f0cf6076fa3e70edb5638b7b0 --- layout/generic/nsImageFrame.cpp | 20 ++++++++++---------- layout/generic/nsImageFrame.h | 8 +++----- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 7464dac6e22b..8def233829fd 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -136,7 +136,7 @@ NS_IMPL_FRAMEARENA_HELPERS(nsImageFrame) nsImageFrame::nsImageFrame(nsStyleContext* aContext) : - ImageFrameSuper(aContext), + nsAtomicContainerFrame(aContext), mComputedSize(0, 0), mIntrinsicRatio(0, 0), mDisplayingIcon(false), @@ -158,7 +158,7 @@ nsImageFrame::~nsImageFrame() NS_QUERYFRAME_HEAD(nsImageFrame) NS_QUERYFRAME_ENTRY(nsImageFrame) -NS_QUERYFRAME_TAIL_INHERITING(ImageFrameSuper) +NS_QUERYFRAME_TAIL_INHERITING(nsAtomicContainerFrame) #ifdef ACCESSIBILITY a11y::AccType @@ -222,13 +222,13 @@ nsImageFrame::DestroyFrom(nsIFrame* aDestructRoot) if (mDisplayingIcon) gIconLoad->RemoveIconObserver(this); - ImageFrameSuper::DestroyFrom(aDestructRoot); + nsAtomicContainerFrame::DestroyFrom(aDestructRoot); } void nsImageFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) { - ImageFrameSuper::DidSetStyleContext(aOldStyleContext); + nsAtomicContainerFrame::DidSetStyleContext(aOldStyleContext); if (!mImage) { // We'll pick this change up whenever we do get an image. @@ -258,7 +258,7 @@ nsImageFrame::Init(nsIContent* aContent, nsContainerFrame* aParent, nsIFrame* aPrevInFlow) { - ImageFrameSuper::Init(aContent, aParent, aPrevInFlow); + nsAtomicContainerFrame::Init(aContent, aParent, aPrevInFlow); mListener = new nsImageListener(this); @@ -1998,7 +1998,7 @@ nsImageFrame::HandleEvent(nsPresContext* aPresContext, } } - return ImageFrameSuper::HandleEvent(aPresContext, aEvent, aEventStatus); + return nsAtomicContainerFrame::HandleEvent(aPresContext, aEvent, aEventStatus); } nsresult @@ -2035,8 +2035,8 @@ nsImageFrame::AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, int32_t aModType) { - nsresult rv = ImageFrameSuper::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + nsresult rv = nsAtomicContainerFrame::AttributeChanged(aNameSpaceID, + aAttribute, aModType); if (NS_FAILED(rv)) { return rv; } @@ -2057,7 +2057,7 @@ nsImageFrame::OnVisibilityChange(Visibility aNewVisibility, nsCOMPtr imageLoader = do_QueryInterface(mContent); if (!imageLoader) { MOZ_ASSERT_UNREACHABLE("Should have an nsIImageLoadingContent"); - ImageFrameSuper::OnVisibilityChange(aNewVisibility, aNonvisibleAction); + nsAtomicContainerFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction); return; } @@ -2067,7 +2067,7 @@ nsImageFrame::OnVisibilityChange(Visibility aNewVisibility, MaybeDecodeForPredictedSize(); } - ImageFrameSuper::OnVisibilityChange(aNewVisibility, aNonvisibleAction); + nsAtomicContainerFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction); } nsIAtom* diff --git a/layout/generic/nsImageFrame.h b/layout/generic/nsImageFrame.h index 175b9b019ccb..784a01cdb4df 100644 --- a/layout/generic/nsImageFrame.h +++ b/layout/generic/nsImageFrame.h @@ -58,10 +58,8 @@ private: nsImageFrame *mFrame; }; -typedef nsAtomicContainerFrame ImageFrameSuper; - -class nsImageFrame : public ImageFrameSuper, - public nsIReflowCallback { +class nsImageFrame : public nsAtomicContainerFrame + , public nsIReflowCallback { public: template using Maybe = mozilla::Maybe; using Nothing = mozilla::Nothing; @@ -119,7 +117,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return ImageFrameSuper::IsFrameOfType(aFlags & + return nsAtomicContainerFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing)); } From cece65618f8fb00422693e18adc1ee2b526e7cea Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 14:22:22 +0800 Subject: [PATCH 50/93] Bug 1264837 Part 7 - Remove nsInlineFrameBase r=dholbert MozReview-Commit-ID: EpEjXmeHVUq --HG-- extra : rebase_source : bd3cf61c11c9faaa447e056d9f8fef4dd4647a01 --- layout/generic/nsInlineFrame.cpp | 6 +++--- layout/generic/nsInlineFrame.h | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp index ca46f6c23428..2eeea3350109 100644 --- a/layout/generic/nsInlineFrame.cpp +++ b/layout/generic/nsInlineFrame.cpp @@ -71,7 +71,7 @@ nsInlineFrame::InvalidateFrame(uint32_t aDisplayItemKey) svgTextFrame->InvalidateFrame(); return; } - nsInlineFrameBase::InvalidateFrame(aDisplayItemKey); + nsContainerFrame::InvalidateFrame(aDisplayItemKey); } void @@ -84,7 +84,7 @@ nsInlineFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayIte svgTextFrame->InvalidateFrame(); return; } - nsInlineFrameBase::InvalidateFrameWithRect(aRect, aDisplayItemKey); + nsContainerFrame::InvalidateFrameWithRect(aRect, aDisplayItemKey); } static inline bool @@ -482,7 +482,7 @@ nsInlineFrame::AttributeChanged(int32_t aNameSpaceID, int32_t aModType) { nsresult rv = - nsInlineFrameBase::AttributeChanged(aNameSpaceID, aAttribute, aModType); + nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); if (NS_FAILED(rv)) { return rv; diff --git a/layout/generic/nsInlineFrame.h b/layout/generic/nsInlineFrame.h index 67a0d113ba74..ae6701772c24 100644 --- a/layout/generic/nsInlineFrame.h +++ b/layout/generic/nsInlineFrame.h @@ -13,15 +13,13 @@ class nsLineLayout; -typedef nsContainerFrame nsInlineFrameBase; - /** * Inline frame class. * * This class manages a list of child frames that are inline frames. Working with * nsLineLayout, the class will reflow and place inline frames on a line. */ -class nsInlineFrame : public nsInlineFrameBase +class nsInlineFrame : public nsContainerFrame { public: NS_DECL_QUERYFRAME_TARGET(nsInlineFrame) From cfc863a8e429a8eced2d136f2b837b3de87acb0a Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 14:01:57 +0800 Subject: [PATCH 51/93] Bug 1264837 Part 8 - Remove nsPluginFrameSuper. r=dholbert MozReview-Commit-ID: C5cPzpZuJBS --HG-- extra : rebase_source : 6fffa5f9aeab0b5ff4327bbfd6b4ec0fd04086a6 --- layout/generic/nsPluginFrame.cpp | 22 +++++++++++----------- layout/generic/nsPluginFrame.h | 10 ++++------ 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/layout/generic/nsPluginFrame.cpp b/layout/generic/nsPluginFrame.cpp index 5ab1e273eb37..93125251d0f9 100644 --- a/layout/generic/nsPluginFrame.cpp +++ b/layout/generic/nsPluginFrame.cpp @@ -150,7 +150,7 @@ protected: }; nsPluginFrame::nsPluginFrame(nsStyleContext* aContext) - : nsPluginFrameSuper(aContext) + : nsFrame(aContext) , mInstanceOwner(nullptr) , mReflowCallbackPosted(false) , mIsHiddenDueToScroll(false) @@ -168,7 +168,7 @@ nsPluginFrame::~nsPluginFrame() NS_QUERYFRAME_HEAD(nsPluginFrame) NS_QUERYFRAME_ENTRY(nsPluginFrame) NS_QUERYFRAME_ENTRY(nsIObjectFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsPluginFrameSuper) +NS_QUERYFRAME_TAIL_INHERITING(nsFrame) #ifdef ACCESSIBILITY a11y::AccType @@ -194,7 +194,7 @@ nsPluginFrame::Init(nsIContent* aContent, MOZ_LOG(sPluginFrameLog, LogLevel::Debug, ("Initializing nsPluginFrame %p for content %p\n", this, aContent)); - nsPluginFrameSuper::Init(aContent, aParent, aPrevInFlow); + nsFrame::Init(aContent, aParent, aPrevInFlow); } void @@ -223,7 +223,7 @@ nsPluginFrame::DestroyFrom(nsIFrame* aDestructRoot) mBackgroundSink->Destroy(); } - nsPluginFrameSuper::DestroyFrom(aDestructRoot); + nsFrame::DestroyFrom(aDestructRoot); } /* virtual */ void @@ -239,7 +239,7 @@ nsPluginFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) } } - nsPluginFrameSuper::DidSetStyleContext(aOldStyleContext); + nsFrame::DidSetStyleContext(aOldStyleContext); } nsIAtom* @@ -737,7 +737,7 @@ nsPluginFrame::IsFocusable(int32_t *aTabIndex, bool aWithMouse) { if (aTabIndex) *aTabIndex = -1; - return nsPluginFrameSuper::IsFocusable(aTabIndex, aWithMouse); + return nsFrame::IsFocusable(aTabIndex, aWithMouse); } bool @@ -851,7 +851,7 @@ nsPluginFrame::DidReflow(nsPresContext* aPresContext, objContent->HasNewFrame(this); } - nsPluginFrameSuper::DidReflow(aPresContext, aReflowState, aStatus); + nsFrame::DidReflow(aPresContext, aReflowState, aStatus); // The view is created hidden; once we have reflowed it and it has been // positioned then we show it. @@ -1670,7 +1670,7 @@ nsPluginFrame::HandleEvent(nsPresContext* aPresContext, } #ifdef XP_WIN - rv = nsPluginFrameSuper::HandleEvent(aPresContext, anEvent, anEventStatus); + rv = nsFrame::HandleEvent(aPresContext, anEvent, anEventStatus); return rv; #endif @@ -1694,10 +1694,10 @@ nsPluginFrame::HandleEvent(nsPresContext* aPresContext, } #endif - rv = nsPluginFrameSuper::HandleEvent(aPresContext, anEvent, anEventStatus); + rv = nsFrame::HandleEvent(aPresContext, anEvent, anEventStatus); // We need to be careful from this point because the call to - // nsPluginFrameSuper::HandleEvent() might have killed us. + // nsFrame::HandleEvent() might have killed us. #ifdef XP_MACOSX if (anEvent->mMessage == eMouseUp) { @@ -1782,7 +1782,7 @@ nsPluginFrame::GetCursor(const nsPoint& aPoint, nsIFrame::Cursor& aCursor) return NS_ERROR_FAILURE; } - return nsPluginFrameSuper::GetCursor(aPoint, aCursor); + return nsFrame::GetCursor(aPoint, aCursor); } void diff --git a/layout/generic/nsPluginFrame.h b/layout/generic/nsPluginFrame.h index 1758b84043ba..d640e450dec1 100644 --- a/layout/generic/nsPluginFrame.h +++ b/layout/generic/nsPluginFrame.h @@ -42,13 +42,11 @@ class LayerManager; } // namespace layers } // namespace mozilla -typedef nsFrame nsPluginFrameSuper; - class PluginFrameDidCompositeObserver; -class nsPluginFrame : public nsPluginFrameSuper, - public nsIObjectFrame, - public nsIReflowCallback +class nsPluginFrame : public nsFrame + , public nsIObjectFrame + , public nsIReflowCallback { public: typedef mozilla::LayerState LayerState; @@ -91,7 +89,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return nsPluginFrameSuper::IsFrameOfType(aFlags & + return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing)); } From 5a26a9b7a3a9cc835749cbdea3454090019bcf08 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 14:04:03 +0800 Subject: [PATCH 52/93] Bug 1264837 Part 9 - Remove nsRubyBaseFrameSuper. r=dholbert MozReview-Commit-ID: 5o0wQcUX9uU --HG-- extra : rebase_source : 08360a028089e74c85e258e042069c79ddb76df0 --- layout/generic/nsRubyBaseFrame.cpp | 2 +- layout/generic/nsRubyBaseFrame.h | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/layout/generic/nsRubyBaseFrame.cpp b/layout/generic/nsRubyBaseFrame.cpp index 7eeb31ea5cfd..668bf77fdaac 100644 --- a/layout/generic/nsRubyBaseFrame.cpp +++ b/layout/generic/nsRubyBaseFrame.cpp @@ -22,7 +22,7 @@ using namespace mozilla; NS_QUERYFRAME_HEAD(nsRubyBaseFrame) NS_QUERYFRAME_ENTRY(nsRubyBaseFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsRubyBaseFrameSuper) +NS_QUERYFRAME_TAIL_INHERITING(nsRubyContentFrame) NS_IMPL_FRAMEARENA_HELPERS(nsRubyBaseFrame) diff --git a/layout/generic/nsRubyBaseFrame.h b/layout/generic/nsRubyBaseFrame.h index 8f9951c300da..b6dde1029380 100644 --- a/layout/generic/nsRubyBaseFrame.h +++ b/layout/generic/nsRubyBaseFrame.h @@ -11,8 +11,6 @@ #include "nsRubyContentFrame.h" -typedef nsRubyContentFrame nsRubyBaseFrameSuper; - /** * Factory function. * @return a newly allocated nsRubyBaseFrame (infallible) @@ -20,7 +18,7 @@ typedef nsRubyContentFrame nsRubyBaseFrameSuper; nsContainerFrame* NS_NewRubyBaseFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); -class nsRubyBaseFrame final : public nsRubyBaseFrameSuper +class nsRubyBaseFrame final : public nsRubyContentFrame { public: NS_DECL_FRAMEARENA_HELPERS @@ -38,7 +36,7 @@ protected: friend nsContainerFrame* NS_NewRubyBaseFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); explicit nsRubyBaseFrame(nsStyleContext* aContext) - : nsRubyBaseFrameSuper(aContext) {} + : nsRubyContentFrame(aContext) {} }; #endif /* nsRubyBaseFrame_h___ */ From ca4c6f2d97aaf8d2831aee7a6935c2fb42d2e6ef Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 14:06:23 +0800 Subject: [PATCH 53/93] Bug 1264837 Part 10 - Remove nsRubyContentFrameSuper. r=dholbert MozReview-Commit-ID: GYsrtHwKfXk --HG-- extra : rebase_source : 0c8da101b6139cf31ae06ed6d093effa05a3e032 --- layout/generic/nsRubyContentFrame.cpp | 2 +- layout/generic/nsRubyContentFrame.h | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/layout/generic/nsRubyContentFrame.cpp b/layout/generic/nsRubyContentFrame.cpp index ce806553c011..c7f0774bb833 100644 --- a/layout/generic/nsRubyContentFrame.cpp +++ b/layout/generic/nsRubyContentFrame.cpp @@ -24,7 +24,7 @@ nsRubyContentFrame::IsFrameOfType(uint32_t aFlags) const if (aFlags & eBidiInlineContainer) { return false; } - return nsRubyContentFrameSuper::IsFrameOfType(aFlags); + return nsInlineFrame::IsFrameOfType(aFlags); } bool diff --git a/layout/generic/nsRubyContentFrame.h b/layout/generic/nsRubyContentFrame.h index b33e6b0993b6..05f8a566d15c 100644 --- a/layout/generic/nsRubyContentFrame.h +++ b/layout/generic/nsRubyContentFrame.h @@ -11,9 +11,7 @@ #include "nsInlineFrame.h" -typedef nsInlineFrame nsRubyContentFrameSuper; - -class nsRubyContentFrame : public nsRubyContentFrameSuper +class nsRubyContentFrame : public nsInlineFrame { public: NS_DECL_ABSTRACT_FRAME(nsRubyContentFrame) @@ -30,7 +28,7 @@ public: protected: explicit nsRubyContentFrame(nsStyleContext* aContext) - : nsRubyContentFrameSuper(aContext) {} + : nsInlineFrame(aContext) {} }; #endif /* nsRubyContentFrame_h___ */ From 29eadce873e8cc0ea9f127bc478b49eb8d5df532 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 14:11:08 +0800 Subject: [PATCH 54/93] Bug 1264837 Part 11 - Remove nsRubyFrameSuper. r=dholbert MozReview-Commit-ID: ISa4OpM0x8i --HG-- extra : rebase_source : 6d5f5f92ab636cdb9a857dca955816d7b7dfccdb --- layout/generic/nsRubyFrame.cpp | 4 ++-- layout/generic/nsRubyFrame.h | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/layout/generic/nsRubyFrame.cpp b/layout/generic/nsRubyFrame.cpp index 9872e209580e..8014b4fb1bf7 100644 --- a/layout/generic/nsRubyFrame.cpp +++ b/layout/generic/nsRubyFrame.cpp @@ -26,7 +26,7 @@ using namespace mozilla; NS_QUERYFRAME_HEAD(nsRubyFrame) NS_QUERYFRAME_ENTRY(nsRubyFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsRubyFrameSuper) +NS_QUERYFRAME_TAIL_INHERITING(nsInlineFrame) NS_IMPL_FRAMEARENA_HELPERS(nsRubyFrame) @@ -54,7 +54,7 @@ nsRubyFrame::IsFrameOfType(uint32_t aFlags) const if (aFlags & eBidiInlineContainer) { return false; } - return nsRubyFrameSuper::IsFrameOfType(aFlags); + return nsInlineFrame::IsFrameOfType(aFlags); } #ifdef DEBUG_FRAME_DUMP diff --git a/layout/generic/nsRubyFrame.h b/layout/generic/nsRubyFrame.h index 125c08afac02..cf002ef48a30 100644 --- a/layout/generic/nsRubyFrame.h +++ b/layout/generic/nsRubyFrame.h @@ -13,8 +13,6 @@ class nsRubyBaseContainerFrame; -typedef nsInlineFrame nsRubyFrameSuper; - /** * Factory function. * @return a newly allocated nsRubyFrame (infallible) @@ -22,7 +20,7 @@ typedef nsInlineFrame nsRubyFrameSuper; nsContainerFrame* NS_NewRubyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); -class nsRubyFrame final : public nsRubyFrameSuper +class nsRubyFrame final : public nsInlineFrame { public: NS_DECL_FRAMEARENA_HELPERS @@ -55,7 +53,7 @@ protected: friend nsContainerFrame* NS_NewRubyFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); explicit nsRubyFrame(nsStyleContext* aContext) - : nsRubyFrameSuper(aContext) {} + : nsInlineFrame(aContext) {} void ReflowSegment(nsPresContext* aPresContext, const nsHTMLReflowState& aReflowState, From e1e171c84e8c6771b798d37d44143813d23c4a01 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 14:12:52 +0800 Subject: [PATCH 55/93] Bug 1264837 Part 12 - Remove nsRubyTextContainerFrameSuper. r=dholbert MozReview-Commit-ID: K3n3gsEkP5f --HG-- extra : rebase_source : f7f227616ee4f07752a2450381a743613eafaa56 --- layout/generic/nsRubyTextContainerFrame.cpp | 10 +++++----- layout/generic/nsRubyTextContainerFrame.h | 6 ++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/layout/generic/nsRubyTextContainerFrame.cpp b/layout/generic/nsRubyTextContainerFrame.cpp index 3c8bd80075e5..1630c3203dd7 100644 --- a/layout/generic/nsRubyTextContainerFrame.cpp +++ b/layout/generic/nsRubyTextContainerFrame.cpp @@ -60,14 +60,14 @@ nsRubyTextContainerFrame::IsFrameOfType(uint32_t aFlags) const if (aFlags & eSupportsCSSTransforms) { return false; } - return nsRubyTextContainerFrameSuper::IsFrameOfType(aFlags); + return nsContainerFrame::IsFrameOfType(aFlags); } /* virtual */ void nsRubyTextContainerFrame::SetInitialChildList(ChildListID aListID, nsFrameList& aChildList) { - nsRubyTextContainerFrameSuper::SetInitialChildList(aListID, aChildList); + nsContainerFrame::SetInitialChildList(aListID, aChildList); if (aListID == kPrincipalList) { UpdateSpanFlag(); } @@ -77,7 +77,7 @@ nsRubyTextContainerFrame::SetInitialChildList(ChildListID aListID, nsRubyTextContainerFrame::AppendFrames(ChildListID aListID, nsFrameList& aFrameList) { - nsRubyTextContainerFrameSuper::AppendFrames(aListID, aFrameList); + nsContainerFrame::AppendFrames(aListID, aFrameList); UpdateSpanFlag(); } @@ -86,7 +86,7 @@ nsRubyTextContainerFrame::InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame, nsFrameList& aFrameList) { - nsRubyTextContainerFrameSuper::InsertFrames(aListID, aPrevFrame, aFrameList); + nsContainerFrame::InsertFrames(aListID, aPrevFrame, aFrameList); UpdateSpanFlag(); } @@ -94,7 +94,7 @@ nsRubyTextContainerFrame::InsertFrames(ChildListID aListID, nsRubyTextContainerFrame::RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) { - nsRubyTextContainerFrameSuper::RemoveFrame(aListID, aOldFrame); + nsContainerFrame::RemoveFrame(aListID, aOldFrame); UpdateSpanFlag(); } diff --git a/layout/generic/nsRubyTextContainerFrame.h b/layout/generic/nsRubyTextContainerFrame.h index c738d79d6029..08ffab9e0e52 100644 --- a/layout/generic/nsRubyTextContainerFrame.h +++ b/layout/generic/nsRubyTextContainerFrame.h @@ -11,8 +11,6 @@ #include "nsBlockFrame.h" -typedef nsContainerFrame nsRubyTextContainerFrameSuper; - /** * Factory function. * @return a newly allocated nsRubyTextContainerFrame (infallible) @@ -20,7 +18,7 @@ typedef nsContainerFrame nsRubyTextContainerFrameSuper; nsContainerFrame* NS_NewRubyTextContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); -class nsRubyTextContainerFrame final : public nsRubyTextContainerFrameSuper +class nsRubyTextContainerFrame final : public nsContainerFrame { public: NS_DECL_FRAMEARENA_HELPERS @@ -59,7 +57,7 @@ protected: NS_NewRubyTextContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); explicit nsRubyTextContainerFrame(nsStyleContext* aContext) - : nsRubyTextContainerFrameSuper(aContext) + : nsContainerFrame(aContext) , mISize(0) {} void UpdateSpanFlag(); From 2f2a208028877b0e188366e6a07d9c42ee1ff6b3 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 14:15:03 +0800 Subject: [PATCH 56/93] Bug 1264837 Part 13 - Remove nsRubyTextFrameSuper. r=dholbert MozReview-Commit-ID: ILOZIBDmeIA --HG-- extra : rebase_source : f71d303fa3c5803bd3d4e911d052e1a288060aa0 --- layout/generic/nsRubyTextFrame.cpp | 7 +++---- layout/generic/nsRubyTextFrame.h | 6 ++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/layout/generic/nsRubyTextFrame.cpp b/layout/generic/nsRubyTextFrame.cpp index ad34ea3e66de..690f8ea4e896 100644 --- a/layout/generic/nsRubyTextFrame.cpp +++ b/layout/generic/nsRubyTextFrame.cpp @@ -22,7 +22,7 @@ using namespace mozilla; NS_QUERYFRAME_HEAD(nsRubyTextFrame) NS_QUERYFRAME_ENTRY(nsRubyTextFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsRubyTextFrameSuper) +NS_QUERYFRAME_TAIL_INHERITING(nsRubyContentFrame) NS_IMPL_FRAMEARENA_HELPERS(nsRubyTextFrame) @@ -70,7 +70,7 @@ nsRubyTextFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, return; } - nsRubyTextFrameSuper::BuildDisplayList(aBuilder, aDirtyRect, aLists); + nsRubyContentFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); } /* virtual */ void @@ -85,8 +85,7 @@ nsRubyTextFrame::Reflow(nsPresContext* aPresContext, // the content is no longer the same, until next reflow triggered by // some other change. In general, we always reflow all the frames we // created. There might be other problems if we don't do that. - nsRubyTextFrameSuper::Reflow(aPresContext, aDesiredSize, - aReflowState, aStatus); + nsRubyContentFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); if (IsAutoHidden()) { // Reset the ISize. The BSize is not changed so that it won't diff --git a/layout/generic/nsRubyTextFrame.h b/layout/generic/nsRubyTextFrame.h index b615c571ec21..ea8784cc2f26 100644 --- a/layout/generic/nsRubyTextFrame.h +++ b/layout/generic/nsRubyTextFrame.h @@ -11,8 +11,6 @@ #include "nsRubyContentFrame.h" -typedef nsRubyContentFrame nsRubyTextFrameSuper; - /** * Factory function. * @return a newly allocated nsRubyTextFrame (infallible) @@ -20,7 +18,7 @@ typedef nsRubyContentFrame nsRubyTextFrameSuper; nsContainerFrame* NS_NewRubyTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); -class nsRubyTextFrame final : public nsRubyTextFrameSuper +class nsRubyTextFrame final : public nsRubyContentFrame { public: NS_DECL_FRAMEARENA_HELPERS @@ -53,7 +51,7 @@ protected: friend nsContainerFrame* NS_NewRubyTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); explicit nsRubyTextFrame(nsStyleContext* aContext) - : nsRubyTextFrameSuper(aContext) {} + : nsRubyContentFrame(aContext) {} }; #endif /* nsRubyTextFrame_h___ */ From f930931ef5987db2e28aee97b066e8e5a99c31d1 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 14:17:58 +0800 Subject: [PATCH 57/93] Bug 1264837 Part 14 - Remove nsSubDocumentFrameSuper. r=dholbert MozReview-Commit-ID: 21VMNckVco7 --HG-- extra : rebase_source : c44ef125c5bc762c85553dfddff8b43cebce4405 --- layout/generic/nsSubDocumentFrame.cpp | 20 ++++++++++---------- layout/generic/nsSubDocumentFrame.h | 6 ++---- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index 8e10498fb778..9883f69b4271 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -56,7 +56,7 @@ GetDocumentFromView(nsView* aView) } nsSubDocumentFrame::nsSubDocumentFrame(nsStyleContext* aContext) - : nsSubDocumentFrameSuper(aContext) + : nsAtomicContainerFrame(aContext) , mIsInline(false) , mPostedReflowCallback(false) , mDidCreateDoc(false) @@ -74,7 +74,7 @@ nsSubDocumentFrame::AccessibleType() NS_QUERYFRAME_HEAD(nsSubDocumentFrame) NS_QUERYFRAME_ENTRY(nsSubDocumentFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsSubDocumentFrameSuper) +NS_QUERYFRAME_TAIL_INHERITING(nsAtomicContainerFrame) class AsyncFrameInit : public nsRunnable { @@ -107,7 +107,7 @@ nsSubDocumentFrame::Init(nsIContent* aContent, nsCOMPtr frameElem = do_QueryInterface(aContent); mIsInline = frameElem ? false : true; - nsSubDocumentFrameSuper::Init(aContent, aParent, aPrevInFlow); + nsAtomicContainerFrame::Init(aContent, aParent, aPrevInFlow); // We are going to create an inner view. If we need a view for the // OuterFrame but we wait for the normal view creation path in @@ -689,7 +689,7 @@ nsSubDocumentFrame::GetIntrinsicSize() if (subDocRoot) { return subDocRoot->GetIntrinsicSize(); } - return nsSubDocumentFrameSuper::GetIntrinsicSize(); + return nsAtomicContainerFrame::GetIntrinsicSize(); } /* virtual */ nsSize @@ -699,7 +699,7 @@ nsSubDocumentFrame::GetIntrinsicRatio() if (subDocRoot) { return subDocRoot->GetIntrinsicRatio(); } - return nsSubDocumentFrameSuper::GetIntrinsicRatio(); + return nsAtomicContainerFrame::GetIntrinsicRatio(); } /* virtual */ @@ -747,10 +747,10 @@ nsSubDocumentFrame::ComputeSize(nsRenderingContext *aRenderingContext, aBorder, aPadding); } - return nsSubDocumentFrameSuper::ComputeSize(aRenderingContext, aWM, - aCBSize, aAvailableISize, - aMargin, aBorder, aPadding, - aFlags); + return nsAtomicContainerFrame::ComputeSize(aRenderingContext, aWM, + aCBSize, aAvailableISize, + aMargin, aBorder, aPadding, + aFlags); } void @@ -995,7 +995,7 @@ nsSubDocumentFrame::DestroyFrom(nsIFrame* aDestructRoot) (mDidCreateDoc || mCallingShow))); } - nsSubDocumentFrameSuper::DestroyFrom(aDestructRoot); + nsAtomicContainerFrame::DestroyFrom(aDestructRoot); } CSSIntSize diff --git a/layout/generic/nsSubDocumentFrame.h b/layout/generic/nsSubDocumentFrame.h index 98916cfb997c..6274bb448d44 100644 --- a/layout/generic/nsSubDocumentFrame.h +++ b/layout/generic/nsSubDocumentFrame.h @@ -12,12 +12,10 @@ #include "nsFrameLoader.h" #include "Units.h" -typedef nsAtomicContainerFrame nsSubDocumentFrameSuper; - /****************************************************************************** * nsSubDocumentFrame *****************************************************************************/ -class nsSubDocumentFrame : public nsSubDocumentFrameSuper, +class nsSubDocumentFrame : public nsAtomicContainerFrame, public nsIReflowCallback { public: @@ -37,7 +35,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return nsSubDocumentFrameSuper::IsFrameOfType(aFlags & + return nsAtomicContainerFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing | nsIFrame::eReplacedContainsBlock)); From 669dc32fe5ed90d56d72347f1b5f2dee5adc6e57 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 14:26:44 +0800 Subject: [PATCH 58/93] Bug 1264837 Part 15 - Remove nsVideoFrameBase r=dholbert MozReview-Commit-ID: JUBNfhJ9LlJ --HG-- extra : rebase_source : 0ce35a28bfadb27a690eb103b9d7cd94e056061f --- layout/generic/nsVideoFrame.cpp | 12 ++++++------ layout/generic/nsVideoFrame.h | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/layout/generic/nsVideoFrame.cpp b/layout/generic/nsVideoFrame.cpp index 824de988e7c7..39a2492a1198 100644 --- a/layout/generic/nsVideoFrame.cpp +++ b/layout/generic/nsVideoFrame.cpp @@ -42,7 +42,7 @@ NS_NewHTMLVideoFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) NS_IMPL_FRAMEARENA_HELPERS(nsVideoFrame) nsVideoFrame::nsVideoFrame(nsStyleContext* aContext) - : nsVideoFrameBase(aContext) + : nsContainerFrame(aContext) { EnableVisibilityTracking(); } @@ -54,7 +54,7 @@ nsVideoFrame::~nsVideoFrame() NS_QUERYFRAME_HEAD(nsVideoFrame) NS_QUERYFRAME_ENTRY(nsVideoFrame) NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) -NS_QUERYFRAME_TAIL_INHERITING(nsVideoFrameBase) +NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame) nsresult nsVideoFrame::CreateAnonymousContent(nsTArray& aElements) @@ -145,7 +145,7 @@ nsVideoFrame::DestroyFrom(nsIFrame* aDestructRoot) nsContentUtils::DestroyAnonymousContent(&mCaptionDiv); nsContentUtils::DestroyAnonymousContent(&mVideoControls); nsContentUtils::DestroyAnonymousContent(&mPosterImage); - nsVideoFrameBase::DestroyFrom(aDestructRoot); + nsContainerFrame::DestroyFrom(aDestructRoot); } bool @@ -612,7 +612,7 @@ nsVideoFrame::AttributeChanged(int32_t aNameSpaceID, if (aAttribute == nsGkAtoms::poster && HasVideoElement()) { UpdatePosterSource(true); } - return nsVideoFrameBase::AttributeChanged(aNameSpaceID, + return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); } @@ -623,13 +623,13 @@ nsVideoFrame::OnVisibilityChange(Visibility aNewVisibility, { nsCOMPtr imageLoader = do_QueryInterface(mPosterImage); if (!imageLoader) { - nsVideoFrameBase::OnVisibilityChange(aNewVisibility, aNonvisibleAction); + nsContainerFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction); return; } imageLoader->OnVisibilityChange(aNewVisibility, aNonvisibleAction); - nsVideoFrameBase::OnVisibilityChange(aNewVisibility, aNonvisibleAction); + nsContainerFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction); } bool nsVideoFrame::HasVideoElement() { diff --git a/layout/generic/nsVideoFrame.h b/layout/generic/nsVideoFrame.h index 68c9009175d3..2a1ea54f8c8b 100644 --- a/layout/generic/nsVideoFrame.h +++ b/layout/generic/nsVideoFrame.h @@ -26,9 +26,8 @@ class nsAString; class nsPresContext; class nsDisplayItem; -typedef nsContainerFrame nsVideoFrameBase; - -class nsVideoFrame : public nsVideoFrameBase, public nsIAnonymousContentCreator +class nsVideoFrame : public nsContainerFrame + , public nsIAnonymousContentCreator { public: template using Maybe = mozilla::Maybe; From ac28e8648a9508aad674ee3b15f92aa06db59373 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 14:32:45 +0800 Subject: [PATCH 59/93] Bug 1264837 Part 16 - Remove ViewportFrame::Super. r=dholbert MozReview-Commit-ID: Bvood4bp7Kl --HG-- extra : rebase_source : fed0289f465dca81f37ffc5f8417f01a5bf41aec --- layout/generic/nsViewportFrame.cpp | 2 +- layout/generic/nsViewportFrame.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/layout/generic/nsViewportFrame.cpp b/layout/generic/nsViewportFrame.cpp index 3a7375582b5f..a49f21e265a7 100644 --- a/layout/generic/nsViewportFrame.cpp +++ b/layout/generic/nsViewportFrame.cpp @@ -36,7 +36,7 @@ ViewportFrame::Init(nsIContent* aContent, nsContainerFrame* aParent, nsIFrame* aPrevInFlow) { - Super::Init(aContent, aParent, aPrevInFlow); + nsContainerFrame::Init(aContent, aParent, aPrevInFlow); nsIFrame* parent = nsLayoutUtils::GetCrossDocParentFrame(this); if (parent) { diff --git a/layout/generic/nsViewportFrame.h b/layout/generic/nsViewportFrame.h index e56aa68661e8..7698e374e1b9 100644 --- a/layout/generic/nsViewportFrame.h +++ b/layout/generic/nsViewportFrame.h @@ -27,8 +27,6 @@ public: NS_DECL_QUERYFRAME NS_DECL_FRAMEARENA_HELPERS - typedef nsContainerFrame Super; - explicit ViewportFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {} From 44aeebed7b69e886e40a2f2234bc84caaa906ee3 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 14:52:46 +0800 Subject: [PATCH 60/93] Bug 1264837 Part 17 - Remove nsSVGAFrameBase. r=dholbert MozReview-Commit-ID: 365bVyNBXIL --HG-- extra : rebase_source : 344c0b98b3eed74c81b71537f6a7958b92c62835 --- layout/svg/nsSVGAFrame.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/layout/svg/nsSVGAFrame.cpp b/layout/svg/nsSVGAFrame.cpp index a7ad04c72db5..a3e22a4c5102 100644 --- a/layout/svg/nsSVGAFrame.cpp +++ b/layout/svg/nsSVGAFrame.cpp @@ -13,15 +13,13 @@ using namespace mozilla; -typedef nsSVGDisplayContainerFrame nsSVGAFrameBase; - -class nsSVGAFrame : public nsSVGAFrameBase +class nsSVGAFrame : public nsSVGDisplayContainerFrame { friend nsIFrame* NS_NewSVGAFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: - explicit nsSVGAFrame(nsStyleContext* aContext) : - nsSVGAFrameBase(aContext) {} + explicit nsSVGAFrame(nsStyleContext* aContext) + : nsSVGDisplayContainerFrame(aContext) {} public: NS_DECL_FRAMEARENA_HELPERS @@ -83,7 +81,7 @@ nsSVGAFrame::Init(nsIContent* aContent, "Trying to construct an SVGAFrame for a " "content element that doesn't support the right interfaces"); - nsSVGAFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ @@ -124,7 +122,7 @@ nsSVGAFrame::NotifySVGChanged(uint32_t aFlags) mCanvasTM = nullptr; } - nsSVGAFrameBase::NotifySVGChanged(aFlags); + nsSVGDisplayContainerFrame::NotifySVGChanged(aFlags); } //---------------------------------------------------------------------- From 083eac991f5b23378468cb4379bdfe23ee918819 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 14:54:51 +0800 Subject: [PATCH 61/93] Bug 1264837 Part 18 - Remove nsSVGClipPathFrameBase. r=dholbert MozReview-Commit-ID: It4pCnQtjDi --HG-- extra : rebase_source : 3828cf4e22915920c50c5377303cc641dc5e0347 --- layout/svg/nsSVGClipPathFrame.cpp | 6 +++--- layout/svg/nsSVGClipPathFrame.h | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/layout/svg/nsSVGClipPathFrame.cpp b/layout/svg/nsSVGClipPathFrame.cpp index b5d21f30da83..0f4d34843b3e 100644 --- a/layout/svg/nsSVGClipPathFrame.cpp +++ b/layout/svg/nsSVGClipPathFrame.cpp @@ -418,8 +418,8 @@ nsSVGClipPathFrame::AttributeChanged(int32_t aNameSpaceID, } } - return nsSVGClipPathFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + return nsSVGContainerFrame::AttributeChanged(aNameSpaceID, + aAttribute, aModType); } void @@ -431,7 +431,7 @@ nsSVGClipPathFrame::Init(nsIContent* aContent, "Content is not an SVG clipPath!"); AddStateBits(NS_STATE_SVG_CLIPPATH_CHILD); - nsSVGClipPathFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow); } nsIAtom * diff --git a/layout/svg/nsSVGClipPathFrame.h b/layout/svg/nsSVGClipPathFrame.h index 3a3a6049d999..c5b3633d346d 100644 --- a/layout/svg/nsSVGClipPathFrame.h +++ b/layout/svg/nsSVGClipPathFrame.h @@ -15,9 +15,7 @@ class gfxContext; class nsISVGChildFrame; -typedef nsSVGContainerFrame nsSVGClipPathFrameBase; - -class nsSVGClipPathFrame : public nsSVGClipPathFrameBase +class nsSVGClipPathFrame : public nsSVGContainerFrame { friend nsIFrame* NS_NewSVGClipPathFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); @@ -27,7 +25,7 @@ class nsSVGClipPathFrame : public nsSVGClipPathFrameBase protected: explicit nsSVGClipPathFrame(nsStyleContext* aContext) - : nsSVGClipPathFrameBase(aContext) + : nsSVGContainerFrame(aContext) , mReferencing(mozilla::AutoReferenceLimiter::notReferencing) { AddStateBits(NS_FRAME_IS_NONDISPLAY); From c85f7ff0ebdbf50b6573b3f58bb5c23fa11bd2dc Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 14:56:50 +0800 Subject: [PATCH 62/93] Bug 1264837 Part 19 - Remove nsSVGContainerFrameBase. r=dholbert MozReview-Commit-ID: EPoMcv1GsnS --HG-- extra : rebase_source : dcd4a223d50e5de8b92d779d35ad0461f35dbecd --- layout/svg/nsSVGContainerFrame.cpp | 4 ++-- layout/svg/nsSVGContainerFrame.h | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/layout/svg/nsSVGContainerFrame.cpp b/layout/svg/nsSVGContainerFrame.cpp index 21758a115696..278aa1261ffa 100644 --- a/layout/svg/nsSVGContainerFrame.cpp +++ b/layout/svg/nsSVGContainerFrame.cpp @@ -20,7 +20,7 @@ using namespace mozilla; NS_QUERYFRAME_HEAD(nsSVGContainerFrame) NS_QUERYFRAME_ENTRY(nsSVGContainerFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGContainerFrameBase) +NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame) NS_QUERYFRAME_HEAD(nsSVGDisplayContainerFrame) NS_QUERYFRAME_ENTRY(nsSVGDisplayContainerFrame) @@ -78,7 +78,7 @@ nsSVGContainerFrame::UpdateOverflow() // XXX It would have be better if the restyle request hadn't even happened. return false; } - return nsSVGContainerFrameBase::UpdateOverflow(); + return nsContainerFrame::UpdateOverflow(); } /** diff --git a/layout/svg/nsSVGContainerFrame.h b/layout/svg/nsSVGContainerFrame.h index 1f059fcd399d..c617377fe1e7 100644 --- a/layout/svg/nsSVGContainerFrame.h +++ b/layout/svg/nsSVGContainerFrame.h @@ -23,8 +23,6 @@ class nsStyleContext; struct nsRect; -typedef nsContainerFrame nsSVGContainerFrameBase; - /** * Base class for SVG container frames. Frame sub-classes that do not * display their contents directly (such as the frames for or @@ -37,13 +35,13 @@ typedef nsContainerFrame nsSVGContainerFrameBase; * Do *not* blindly cast to SVG element types in this class's methods (see the * warning comment for nsSVGDisplayContainerFrame below). */ -class nsSVGContainerFrame : public nsSVGContainerFrameBase +class nsSVGContainerFrame : public nsContainerFrame { friend nsIFrame* NS_NewSVGContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: explicit nsSVGContainerFrame(nsStyleContext* aContext) - : nsSVGContainerFrameBase(aContext) + : nsContainerFrame(aContext) { AddStateBits(NS_FRAME_SVG_LAYOUT); } @@ -80,7 +78,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return nsSVGContainerFrameBase::IsFrameOfType( + return nsContainerFrame::IsFrameOfType( aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGContainer)); } From a8f27af21d4798a4262b68059ec3f17bcc3ea42a Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:02:37 +0800 Subject: [PATCH 63/93] Bug 1264837 Part 20 - Remove nsSVGFilterFrameBase. r=dholbert MozReview-Commit-ID: 9VzfqZpVVVK --HG-- extra : rebase_source : 898e9d47c1af204dbbdf9537ed59162d1a54399c --- layout/svg/nsSVGFilterFrame.cpp | 6 +++--- layout/svg/nsSVGFilterFrame.h | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/layout/svg/nsSVGFilterFrame.cpp b/layout/svg/nsSVGFilterFrame.cpp index c65314ce9b24..8ebffa358ef3 100644 --- a/layout/svg/nsSVGFilterFrame.cpp +++ b/layout/svg/nsSVGFilterFrame.cpp @@ -179,8 +179,8 @@ nsSVGFilterFrame::AttributeChanged(int32_t aNameSpaceID, // And update whoever references us nsSVGEffects::InvalidateDirectRenderingObservers(this); } - return nsSVGFilterFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + return nsSVGContainerFrame::AttributeChanged(aNameSpaceID, + aAttribute, aModType); } #ifdef DEBUG @@ -192,7 +192,7 @@ nsSVGFilterFrame::Init(nsIContent* aContent, NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::filter), "Content is not an SVG filter"); - nsSVGFilterFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ diff --git a/layout/svg/nsSVGFilterFrame.h b/layout/svg/nsSVGFilterFrame.h index b0e334d46636..223c787f6e85 100644 --- a/layout/svg/nsSVGFilterFrame.h +++ b/layout/svg/nsSVGFilterFrame.h @@ -27,17 +27,15 @@ class SVGFilterElement; } // namespace dom } // namespace mozilla -typedef nsSVGContainerFrame nsSVGFilterFrameBase; - -class nsSVGFilterFrame : public nsSVGFilterFrameBase +class nsSVGFilterFrame : public nsSVGContainerFrame { friend nsIFrame* NS_NewSVGFilterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: explicit nsSVGFilterFrame(nsStyleContext* aContext) - : nsSVGFilterFrameBase(aContext), - mLoopFlag(false), - mNoHRefURI(false) + : nsSVGContainerFrame(aContext) + , mLoopFlag(false) + , mNoHRefURI(false) { AddStateBits(NS_FRAME_IS_NONDISPLAY); } From fdd9183c2ba168c4ec9fc68e3b7d02d4c25ec037 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:05:48 +0800 Subject: [PATCH 64/93] Bug 1264837 Part 21 - Remove nsSVGForeignObjectFrameBase. r=dholbert MozReview-Commit-ID: IP7Z43hrcbc --HG-- extra : rebase_source : 027a5aff3b14400b8fbd2aa64703bc049082a252 --- layout/svg/nsSVGForeignObjectFrame.cpp | 10 +++++----- layout/svg/nsSVGForeignObjectFrame.h | 8 +++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/layout/svg/nsSVGForeignObjectFrame.cpp b/layout/svg/nsSVGForeignObjectFrame.cpp index 0649b39fff4f..87533ec4edf8 100644 --- a/layout/svg/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/nsSVGForeignObjectFrame.cpp @@ -37,8 +37,8 @@ NS_NewSVGForeignObjectFrame(nsIPresShell *aPresShell, NS_IMPL_FRAMEARENA_HELPERS(nsSVGForeignObjectFrame) nsSVGForeignObjectFrame::nsSVGForeignObjectFrame(nsStyleContext* aContext) - : nsSVGForeignObjectFrameBase(aContext), - mInReflow(false) + : nsContainerFrame(aContext) + , mInReflow(false) { AddStateBits(NS_FRAME_REFLOW_ROOT | NS_FRAME_MAY_BE_TRANSFORMED | NS_FRAME_SVG_LAYOUT); @@ -49,7 +49,7 @@ nsSVGForeignObjectFrame::nsSVGForeignObjectFrame(nsStyleContext* aContext) NS_QUERYFRAME_HEAD(nsSVGForeignObjectFrame) NS_QUERYFRAME_ENTRY(nsISVGChildFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGForeignObjectFrameBase) +NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame) void nsSVGForeignObjectFrame::Init(nsIContent* aContent, @@ -59,7 +59,7 @@ nsSVGForeignObjectFrame::Init(nsIContent* aContent, NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::foreignObject), "Content is not an SVG foreignObject!"); - nsSVGForeignObjectFrameBase::Init(aContent, aParent, aPrevInFlow); + nsContainerFrame::Init(aContent, aParent, aPrevInFlow); AddStateBits(aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD); AddStateBits(NS_FRAME_FONT_INFLATION_CONTAINER | NS_FRAME_FONT_INFLATION_FLOW_ROOT); @@ -74,7 +74,7 @@ void nsSVGForeignObjectFrame::DestroyFrom(nsIFrame* aDestructRoot) if (!(mState & NS_FRAME_IS_NONDISPLAY)) { nsSVGUtils::GetOuterSVGFrame(this)->UnregisterForeignObject(this); } - nsSVGForeignObjectFrameBase::DestroyFrom(aDestructRoot); + nsContainerFrame::DestroyFrom(aDestructRoot); } nsIAtom * diff --git a/layout/svg/nsSVGForeignObjectFrame.h b/layout/svg/nsSVGForeignObjectFrame.h index 3cd3b03bdf8b..34d67eb477c4 100644 --- a/layout/svg/nsSVGForeignObjectFrame.h +++ b/layout/svg/nsSVGForeignObjectFrame.h @@ -15,10 +15,8 @@ class gfxContext; -typedef nsContainerFrame nsSVGForeignObjectFrameBase; - -class nsSVGForeignObjectFrame : public nsSVGForeignObjectFrameBase, - public nsISVGChildFrame +class nsSVGForeignObjectFrame : public nsContainerFrame + , public nsISVGChildFrame { friend nsContainerFrame* NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); @@ -60,7 +58,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return nsSVGForeignObjectFrameBase::IsFrameOfType(aFlags & + return nsContainerFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject)); } From 6cd43df135924dfbda8f5670d762bb83cdde2b46 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:11:10 +0800 Subject: [PATCH 65/93] Bug 1264837 Part 22 - Remove nsSVGGenericContainerFrameBase. r=dholbert MozReview-Commit-ID: A3Mct3IxlJW --HG-- extra : rebase_source : b9089ea6789e67fbf7dc6cc1a05490c3af668123 --- layout/svg/nsSVGGenericContainerFrame.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/layout/svg/nsSVGGenericContainerFrame.h b/layout/svg/nsSVGGenericContainerFrame.h index 0285df53ea37..eff7375baf07 100644 --- a/layout/svg/nsSVGGenericContainerFrame.h +++ b/layout/svg/nsSVGGenericContainerFrame.h @@ -18,15 +18,15 @@ class nsIFrame; class nsIPresShell; class nsStyleContext; -typedef nsSVGDisplayContainerFrame nsSVGGenericContainerFrameBase; - -class nsSVGGenericContainerFrame : public nsSVGGenericContainerFrameBase +class nsSVGGenericContainerFrame : public nsSVGDisplayContainerFrame { friend nsIFrame* NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); + protected: - explicit nsSVGGenericContainerFrame(nsStyleContext* aContext) : nsSVGGenericContainerFrameBase(aContext) {} - + explicit nsSVGGenericContainerFrame(nsStyleContext* aContext) + : nsSVGDisplayContainerFrame(aContext) {} + public: NS_DECL_FRAMEARENA_HELPERS From e8c169c7ba8047ddf8cbdb5d66c1c1a0fe026209 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:08:01 +0800 Subject: [PATCH 66/93] Bug 1264837 Part 23 - Remove nsSVGGFrameBase. r=dholbert MozReview-Commit-ID: 1QzQaR9tUIZ --HG-- extra : rebase_source : 91d35cd35d0586f100e32dd6cd278df824f17515 --- layout/svg/nsSVGGFrame.cpp | 8 ++++---- layout/svg/nsSVGGFrame.h | 8 +++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/layout/svg/nsSVGGFrame.cpp b/layout/svg/nsSVGGFrame.cpp index 76daf71f9522..1fc124956490 100644 --- a/layout/svg/nsSVGGFrame.cpp +++ b/layout/svg/nsSVGGFrame.cpp @@ -21,7 +21,7 @@ using namespace mozilla::dom; nsIFrame* NS_NewSVGGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) -{ +{ return new (aPresShell) nsSVGGFrame(aContext); } @@ -37,7 +37,7 @@ nsSVGGFrame::Init(nsIContent* aContent, static_cast(aContent)->IsTransformable(), "The element doesn't support nsIDOMSVGTransformable"); - nsSVGGFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ @@ -61,7 +61,7 @@ nsSVGGFrame::NotifySVGChanged(uint32_t aFlags) mCanvasTM = nullptr; } - nsSVGGFrameBase::NotifySVGChanged(aFlags); + nsSVGDisplayContainerFrame::NotifySVGChanged(aFlags); } gfxMatrix @@ -93,6 +93,6 @@ nsSVGGFrame::AttributeChanged(int32_t aNameSpaceID, // and cause DoApplyRenderingChangeToTree to make the SchedulePaint call. NotifySVGChanged(TRANSFORM_CHANGED); } - + return NS_OK; } diff --git a/layout/svg/nsSVGGFrame.h b/layout/svg/nsSVGGFrame.h index 987592589799..c80e4ef8613b 100644 --- a/layout/svg/nsSVGGFrame.h +++ b/layout/svg/nsSVGGFrame.h @@ -10,15 +10,13 @@ #include "gfxMatrix.h" #include "nsSVGContainerFrame.h" -typedef nsSVGDisplayContainerFrame nsSVGGFrameBase; - -class nsSVGGFrame : public nsSVGGFrameBase +class nsSVGGFrame : public nsSVGDisplayContainerFrame { friend nsIFrame* NS_NewSVGGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: - explicit nsSVGGFrame(nsStyleContext* aContext) : - nsSVGGFrameBase(aContext) {} + explicit nsSVGGFrame(nsStyleContext* aContext) + : nsSVGDisplayContainerFrame(aContext) {} public: NS_DECL_FRAMEARENA_HELPERS From 15fbb68d145b8efbe5bfba5df3975976ec498c3f Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:15:23 +0800 Subject: [PATCH 67/93] Bug 1264837 Part 24 - Remove nsSVGGradientFrameBase. r=dholbert MozReview-Commit-ID: CGIBpG8buVU --HG-- extra : rebase_source : 1b083bea0bda01cb3557ffe7885934e70b788eed --- layout/svg/nsSVGGradientFrame.cpp | 12 ++++++------ layout/svg/nsSVGGradientFrame.h | 4 +--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/layout/svg/nsSVGGradientFrame.cpp b/layout/svg/nsSVGGradientFrame.cpp index f16a8a658670..d46f60b10eab 100644 --- a/layout/svg/nsSVGGradientFrame.cpp +++ b/layout/svg/nsSVGGradientFrame.cpp @@ -48,10 +48,10 @@ private: //---------------------------------------------------------------------- // Implementation -nsSVGGradientFrame::nsSVGGradientFrame(nsStyleContext* aContext) : - nsSVGGradientFrameBase(aContext), - mLoopFlag(false), - mNoHRefURI(false) +nsSVGGradientFrame::nsSVGGradientFrame(nsStyleContext* aContext) + : nsSVGPaintServerFrame(aContext) + , mLoopFlag(false) + , mNoHRefURI(false) { } @@ -77,8 +77,8 @@ nsSVGGradientFrame::AttributeChanged(int32_t aNameSpaceID, nsSVGEffects::InvalidateDirectRenderingObservers(this); } - return nsSVGGradientFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + return nsSVGPaintServerFrame::AttributeChanged(aNameSpaceID, + aAttribute, aModType); } //---------------------------------------------------------------------- diff --git a/layout/svg/nsSVGGradientFrame.h b/layout/svg/nsSVGGradientFrame.h index 8e6eba9766c9..e048bc54d173 100644 --- a/layout/svg/nsSVGGradientFrame.h +++ b/layout/svg/nsSVGGradientFrame.h @@ -31,13 +31,11 @@ class SVGRadialGradientElement; } // namespace dom } // namespace mozilla -typedef nsSVGPaintServerFrame nsSVGGradientFrameBase; - /** * Gradients can refer to other gradients. We create an nsSVGPaintingProperty * with property type nsGkAtoms::href to track the referenced gradient. */ -class nsSVGGradientFrame : public nsSVGGradientFrameBase +class nsSVGGradientFrame : public nsSVGPaintServerFrame { typedef mozilla::gfx::ExtendMode ExtendMode; From 35ba281a41bdbbfb38ac94120bdd2d8f9df1eef9 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:17:35 +0800 Subject: [PATCH 68/93] Bug 1264837 Part 25 - Remove nsSVGLinearGradientFrameBase. r=dholbert MozReview-Commit-ID: 5o57Ai4Wbsx --HG-- extra : rebase_source : 0e47dfb900912154be8f2fc747d26861c2597ead --- layout/svg/nsSVGGradientFrame.cpp | 5 ++--- layout/svg/nsSVGGradientFrame.h | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/layout/svg/nsSVGGradientFrame.cpp b/layout/svg/nsSVGGradientFrame.cpp index d46f60b10eab..d9cbd6c839b8 100644 --- a/layout/svg/nsSVGGradientFrame.cpp +++ b/layout/svg/nsSVGGradientFrame.cpp @@ -405,7 +405,7 @@ nsSVGLinearGradientFrame::Init(nsIContent* aContent, NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::linearGradient), "Content is not an SVG linearGradient"); - nsSVGLinearGradientFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGGradientFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ @@ -474,8 +474,7 @@ nsSVGLinearGradientFrame::GetLinearGradientWithLength(uint32_t aIndex, return thisElement; } - return nsSVGLinearGradientFrameBase::GetLinearGradientWithLength(aIndex, - aDefault); + return nsSVGGradientFrame::GetLinearGradientWithLength(aIndex, aDefault); } bool diff --git a/layout/svg/nsSVGGradientFrame.h b/layout/svg/nsSVGGradientFrame.h index e048bc54d173..02342488aaf3 100644 --- a/layout/svg/nsSVGGradientFrame.h +++ b/layout/svg/nsSVGGradientFrame.h @@ -124,15 +124,13 @@ private: // Linear Gradients // ------------------------------------------------------------------------- -typedef nsSVGGradientFrame nsSVGLinearGradientFrameBase; - -class nsSVGLinearGradientFrame : public nsSVGLinearGradientFrameBase +class nsSVGLinearGradientFrame : public nsSVGGradientFrame { friend nsIFrame* NS_NewSVGLinearGradientFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: - explicit nsSVGLinearGradientFrame(nsStyleContext* aContext) : - nsSVGLinearGradientFrameBase(aContext) {} + explicit nsSVGLinearGradientFrame(nsStyleContext* aContext) + : nsSVGGradientFrame(aContext) {} public: NS_DECL_FRAMEARENA_HELPERS From c46a3ce530a1e33064774135e63f9e21c442a669 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:19:21 +0800 Subject: [PATCH 69/93] Bug 1264837 Part 26 - Remove nsSVGRadialGradientFrameBase. r=dholbert MozReview-Commit-ID: DPgBVVoWied --HG-- extra : rebase_source : cf47d943dbd90e401a591636e2dc1924181968c2 --- layout/svg/nsSVGGradientFrame.cpp | 5 ++--- layout/svg/nsSVGGradientFrame.h | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/layout/svg/nsSVGGradientFrame.cpp b/layout/svg/nsSVGGradientFrame.cpp index d9cbd6c839b8..e4e337f0e70e 100644 --- a/layout/svg/nsSVGGradientFrame.cpp +++ b/layout/svg/nsSVGGradientFrame.cpp @@ -513,7 +513,7 @@ nsSVGRadialGradientFrame::Init(nsIContent* aContent, NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::radialGradient), "Content is not an SVG radialGradient"); - nsSVGRadialGradientFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGGradientFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ @@ -600,8 +600,7 @@ nsSVGRadialGradientFrame::GetRadialGradientWithLength(uint32_t aIndex, return thisElement; } - return nsSVGRadialGradientFrameBase::GetRadialGradientWithLength(aIndex, - aDefault); + return nsSVGGradientFrame::GetRadialGradientWithLength(aIndex, aDefault); } bool diff --git a/layout/svg/nsSVGGradientFrame.h b/layout/svg/nsSVGGradientFrame.h index 02342488aaf3..f12b132533a3 100644 --- a/layout/svg/nsSVGGradientFrame.h +++ b/layout/svg/nsSVGGradientFrame.h @@ -167,15 +167,13 @@ protected: // Radial Gradients // ------------------------------------------------------------------------- -typedef nsSVGGradientFrame nsSVGRadialGradientFrameBase; - -class nsSVGRadialGradientFrame : public nsSVGRadialGradientFrameBase +class nsSVGRadialGradientFrame : public nsSVGGradientFrame { friend nsIFrame* NS_NewSVGRadialGradientFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: - explicit nsSVGRadialGradientFrame(nsStyleContext* aContext) : - nsSVGRadialGradientFrameBase(aContext) {} + explicit nsSVGRadialGradientFrame(nsStyleContext* aContext) + : nsSVGGradientFrame(aContext) {} public: NS_DECL_FRAMEARENA_HELPERS From 3f28016e07eea9d6d405975fe92732268a807329 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:21:40 +0800 Subject: [PATCH 70/93] Bug 1264837 Part 27 - Remove nsSVGImageFrameBase. r=dholbert MozReview-Commit-ID: Guh2gWnm45y --HG-- extra : rebase_source : 484e9acfd77efb85e9e7b2cf18b5f54746eb59e8 --- layout/svg/nsSVGImageFrame.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/layout/svg/nsSVGImageFrame.cpp b/layout/svg/nsSVGImageFrame.cpp index f80e5caae707..3f40f9b98010 100644 --- a/layout/svg/nsSVGImageFrame.cpp +++ b/layout/svg/nsSVGImageFrame.cpp @@ -45,17 +45,15 @@ private: nsSVGImageFrame *mFrame; }; -typedef nsSVGPathGeometryFrame nsSVGImageFrameBase; - -class nsSVGImageFrame : public nsSVGImageFrameBase, - public nsIReflowCallback +class nsSVGImageFrame : public nsSVGPathGeometryFrame + , public nsIReflowCallback { friend nsIFrame* NS_NewSVGImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: explicit nsSVGImageFrame(nsStyleContext* aContext) - : nsSVGImageFrameBase(aContext) + : nsSVGPathGeometryFrame(aContext) , mReflowCallbackPosted(false) { EnableVisibilityTracking(); @@ -155,7 +153,7 @@ nsSVGImageFrame::Init(nsIContent* aContent, NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::image), "Content is not an SVG image!"); - nsSVGImageFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGPathGeometryFrame::Init(aContent, aParent, aPrevInFlow); if (GetStateBits() & NS_FRAME_IS_NONDISPLAY) { // Non-display frames are likely to be patterns, masks or the like. @@ -237,8 +235,8 @@ nsSVGImageFrame::AttributeChanged(int32_t aNameSpaceID, } } - return nsSVGImageFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + return nsSVGPathGeometryFrame::AttributeChanged(aNameSpaceID, + aAttribute, aModType); } void @@ -247,13 +245,13 @@ nsSVGImageFrame::OnVisibilityChange(Visibility aNewVisibility, { nsCOMPtr imageLoader = do_QueryInterface(mContent); if (!imageLoader) { - nsSVGImageFrameBase::OnVisibilityChange(aNewVisibility, aNonvisibleAction); + nsSVGPathGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction); return; } imageLoader->OnVisibilityChange(aNewVisibility, aNonvisibleAction); - nsSVGImageFrameBase::OnVisibilityChange(aNewVisibility, aNonvisibleAction); + nsSVGPathGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction); } gfx::Matrix From afb3cb78a8b67f40fbf6a8782dd570af3e89ff17 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:23:52 +0800 Subject: [PATCH 71/93] Bug 1264837 Part 28 - Remove nsSVGInnerSVGFrameBase. r=dholbert MozReview-Commit-ID: Ky1RyuhE7Tt --HG-- extra : rebase_source : 6122955fdd694ac1e0169988e7bd9d5db7f2201e --- layout/svg/nsSVGInnerSVGFrame.cpp | 12 ++++++------ layout/svg/nsSVGInnerSVGFrame.h | 12 +++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/layout/svg/nsSVGInnerSVGFrame.cpp b/layout/svg/nsSVGInnerSVGFrame.cpp index f1f308402041..2a6965655b4b 100644 --- a/layout/svg/nsSVGInnerSVGFrame.cpp +++ b/layout/svg/nsSVGInnerSVGFrame.cpp @@ -33,7 +33,7 @@ NS_IMPL_FRAMEARENA_HELPERS(nsSVGInnerSVGFrame) NS_QUERYFRAME_HEAD(nsSVGInnerSVGFrame) NS_QUERYFRAME_ENTRY(nsSVGInnerSVGFrame) NS_QUERYFRAME_ENTRY(nsISVGSVGFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGInnerSVGFrameBase) +NS_QUERYFRAME_TAIL_INHERITING(nsSVGDisplayContainerFrame) #ifdef DEBUG void @@ -44,7 +44,7 @@ nsSVGInnerSVGFrame::Init(nsIContent* aContent, NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::svg), "Content is not an SVG 'svg' element!"); - nsSVGInnerSVGFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ @@ -84,7 +84,7 @@ nsSVGInnerSVGFrame::PaintSVG(gfxContext& aContext, nsSVGUtils::SetClipRect(&aContext, aTransform, clipRect); } - return nsSVGInnerSVGFrameBase::PaintSVG(aContext, aTransform, aDirtyRect); + return nsSVGDisplayContainerFrame::PaintSVG(aContext, aTransform, aDirtyRect); } nsRect @@ -124,7 +124,7 @@ nsSVGInnerSVGFrame::ReflowSVG() InvalidateFrame(); } - nsSVGInnerSVGFrameBase::ReflowSVG(); + nsSVGDisplayContainerFrame::ReflowSVG(); } void @@ -181,7 +181,7 @@ nsSVGInnerSVGFrame::NotifySVGChanged(uint32_t aFlags) mCanvasTM = nullptr; } - nsSVGInnerSVGFrameBase::NotifySVGChanged(aFlags); + nsSVGDisplayContainerFrame::NotifySVGChanged(aFlags); } nsresult @@ -269,7 +269,7 @@ nsSVGInnerSVGFrame::GetFrameForPoint(const gfxPoint& aPoint) } } - return nsSVGInnerSVGFrameBase::GetFrameForPoint(aPoint); + return nsSVGDisplayContainerFrame::GetFrameForPoint(aPoint); } //---------------------------------------------------------------------- diff --git a/layout/svg/nsSVGInnerSVGFrame.h b/layout/svg/nsSVGInnerSVGFrame.h index a683f7266c18..acab7b411198 100644 --- a/layout/svg/nsSVGInnerSVGFrame.h +++ b/layout/svg/nsSVGInnerSVGFrame.h @@ -12,17 +12,15 @@ class gfxContext; -typedef nsSVGDisplayContainerFrame nsSVGInnerSVGFrameBase; - -class nsSVGInnerSVGFrame : public nsSVGInnerSVGFrameBase, - public nsISVGSVGFrame +class nsSVGInnerSVGFrame : public nsSVGDisplayContainerFrame + , public nsISVGSVGFrame { friend nsIFrame* NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: - explicit nsSVGInnerSVGFrame(nsStyleContext* aContext) : - nsSVGInnerSVGFrameBase(aContext) {} - + explicit nsSVGInnerSVGFrame(nsStyleContext* aContext) + : nsSVGDisplayContainerFrame(aContext) {} + public: NS_DECL_QUERYFRAME_TARGET(nsSVGInnerSVGFrame) NS_DECL_QUERYFRAME From 836528eeac993056de4df9e15eadfc9fa2b62a73 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:26:00 +0800 Subject: [PATCH 72/93] Bug 1264837 Part 29 - Remove nsSVGMarkerFrameBase. r=dholbert MozReview-Commit-ID: ECmFfNirWo3 --HG-- extra : rebase_source : a4e74c1f3c1f3eca805af89762b8260360ceb265 --- layout/svg/nsSVGMarkerFrame.cpp | 6 +++--- layout/svg/nsSVGMarkerFrame.h | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/layout/svg/nsSVGMarkerFrame.cpp b/layout/svg/nsSVGMarkerFrame.cpp index 46a114e137ee..d102557c55a3 100644 --- a/layout/svg/nsSVGMarkerFrame.cpp +++ b/layout/svg/nsSVGMarkerFrame.cpp @@ -44,8 +44,8 @@ nsSVGMarkerFrame::AttributeChanged(int32_t aNameSpaceID, nsSVGEffects::InvalidateDirectRenderingObservers(this); } - return nsSVGMarkerFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + return nsSVGContainerFrame::AttributeChanged(aNameSpaceID, + aAttribute, aModType); } #ifdef DEBUG @@ -56,7 +56,7 @@ nsSVGMarkerFrame::Init(nsIContent* aContent, { NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::marker), "Content is not an SVG marker"); - nsSVGMarkerFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ diff --git a/layout/svg/nsSVGMarkerFrame.h b/layout/svg/nsSVGMarkerFrame.h index a40c09c510b7..bd399efccd2b 100644 --- a/layout/svg/nsSVGMarkerFrame.h +++ b/layout/svg/nsSVGMarkerFrame.h @@ -26,16 +26,14 @@ class SVGSVGElement; struct nsSVGMark; -typedef nsSVGContainerFrame nsSVGMarkerFrameBase; - -class nsSVGMarkerFrame : public nsSVGMarkerFrameBase +class nsSVGMarkerFrame : public nsSVGContainerFrame { friend class nsSVGMarkerAnonChildFrame; friend nsContainerFrame* NS_NewSVGMarkerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: explicit nsSVGMarkerFrame(nsStyleContext* aContext) - : nsSVGMarkerFrameBase(aContext) + : nsSVGContainerFrame(aContext) , mMarkedFrame(nullptr) , mInUse(false) , mInUse2(false) From 9ef3b285a4411885467bf7ce772bf0e0a645eb54 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:28:03 +0800 Subject: [PATCH 73/93] Bug 1264837 Part 30 - Remove nsSVGMarkerAnonChildFrameBase. r=dholbert MozReview-Commit-ID: C9G8KoYAna3 --HG-- extra : rebase_source : 87df6e46ff6a26fcdcabaab24dfd6a8c0b044690 --- layout/svg/nsSVGMarkerFrame.cpp | 2 +- layout/svg/nsSVGMarkerFrame.h | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/layout/svg/nsSVGMarkerFrame.cpp b/layout/svg/nsSVGMarkerFrame.cpp index d102557c55a3..4eba42c7be4b 100644 --- a/layout/svg/nsSVGMarkerFrame.cpp +++ b/layout/svg/nsSVGMarkerFrame.cpp @@ -267,7 +267,7 @@ nsSVGMarkerAnonChildFrame::Init(nsIContent* aContent, { MOZ_ASSERT(aParent->GetType() == nsGkAtoms::svgMarkerFrame, "Unexpected parent"); - nsSVGMarkerAnonChildFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow); } #endif diff --git a/layout/svg/nsSVGMarkerFrame.h b/layout/svg/nsSVGMarkerFrame.h index bd399efccd2b..22ac01709024 100644 --- a/layout/svg/nsSVGMarkerFrame.h +++ b/layout/svg/nsSVGMarkerFrame.h @@ -133,19 +133,14 @@ private: //////////////////////////////////////////////////////////////////////// // nsMarkerAnonChildFrame class -typedef nsSVGDisplayContainerFrame nsSVGMarkerAnonChildFrameBase; - -/** - */ -class nsSVGMarkerAnonChildFrame - : public nsSVGMarkerAnonChildFrameBase +class nsSVGMarkerAnonChildFrame : public nsSVGDisplayContainerFrame { friend nsContainerFrame* NS_NewSVGMarkerAnonChildFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); explicit nsSVGMarkerAnonChildFrame(nsStyleContext* aContext) - : nsSVGMarkerAnonChildFrameBase(aContext) + : nsSVGDisplayContainerFrame(aContext) {} public: From 39914e42eb0266fcd448b6ee753149adf18ad558 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:30:09 +0800 Subject: [PATCH 74/93] Bug 1264837 Part 31 - Remove nsSVGMaskFrameBase. r=dholbert MozReview-Commit-ID: DMAj31tSGhv --HG-- extra : rebase_source : 1c6a0619d6149f739a59aa99e79dda0b2f7fac1c --- layout/svg/nsSVGMaskFrame.cpp | 6 +++--- layout/svg/nsSVGMaskFrame.h | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/layout/svg/nsSVGMaskFrame.cpp b/layout/svg/nsSVGMaskFrame.cpp index ba2af4c4069f..5cc8292587f7 100644 --- a/layout/svg/nsSVGMaskFrame.cpp +++ b/layout/svg/nsSVGMaskFrame.cpp @@ -360,8 +360,8 @@ nsSVGMaskFrame::AttributeChanged(int32_t aNameSpaceID, nsSVGEffects::InvalidateDirectRenderingObservers(this); } - return nsSVGMaskFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + return nsSVGContainerFrame::AttributeChanged(aNameSpaceID, + aAttribute, aModType); } #ifdef DEBUG @@ -373,7 +373,7 @@ nsSVGMaskFrame::Init(nsIContent* aContent, NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::mask), "Content is not an SVG mask"); - nsSVGMaskFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ diff --git a/layout/svg/nsSVGMaskFrame.h b/layout/svg/nsSVGMaskFrame.h index fbd37edd3cf6..295808f40ce6 100644 --- a/layout/svg/nsSVGMaskFrame.h +++ b/layout/svg/nsSVGMaskFrame.h @@ -16,8 +16,6 @@ class gfxContext; -typedef nsSVGContainerFrame nsSVGMaskFrameBase; - /** * Byte offsets of channels in a native packed gfxColor or cairo image surface. */ @@ -33,7 +31,7 @@ typedef nsSVGContainerFrame nsSVGMaskFrameBase; #define GFX_ARGB32_OFFSET_B 0 #endif -class nsSVGMaskFrame final : public nsSVGMaskFrameBase +class nsSVGMaskFrame final : public nsSVGContainerFrame { friend nsIFrame* NS_NewSVGMaskFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); @@ -43,7 +41,7 @@ class nsSVGMaskFrame final : public nsSVGMaskFrameBase protected: explicit nsSVGMaskFrame(nsStyleContext* aContext) - : nsSVGMaskFrameBase(aContext) + : nsSVGContainerFrame(aContext) , mInUse(false) { AddStateBits(NS_FRAME_IS_NONDISPLAY); From 58668ec6f6f0f9ed8d11b31248ec0f7679e62f7c Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:32:11 +0800 Subject: [PATCH 75/93] Bug 1264837 Part 32 - Remove nsSVGOuterSVGFrameBase. r=dholbert MozReview-Commit-ID: qFKf1Da8Cn --HG-- extra : rebase_source : 27725a6a456de8383bd2869f568dfc2668c3b3fd --- layout/svg/nsSVGOuterSVGFrame.cpp | 13 ++++++------- layout/svg/nsSVGOuterSVGFrame.h | 6 ++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/layout/svg/nsSVGOuterSVGFrame.cpp b/layout/svg/nsSVGOuterSVGFrame.cpp index 328ba083d146..45c9edb9e6ae 100644 --- a/layout/svg/nsSVGOuterSVGFrame.cpp +++ b/layout/svg/nsSVGOuterSVGFrame.cpp @@ -56,14 +56,14 @@ nsSVGOuterSVGFrame::UnregisterForeignObject(nsSVGForeignObjectFrame* aFrame) nsContainerFrame* NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) -{ +{ return new (aPresShell) nsSVGOuterSVGFrame(aContext); } NS_IMPL_FRAMEARENA_HELPERS(nsSVGOuterSVGFrame) nsSVGOuterSVGFrame::nsSVGOuterSVGFrame(nsStyleContext* aContext) - : nsSVGOuterSVGFrameBase(aContext) + : nsSVGDisplayContainerFrame(aContext) , mFullZoom(aContext->PresContext()->GetFullZoom()) , mViewportInitialized(false) , mIsRootContent(false) @@ -112,7 +112,7 @@ nsSVGOuterSVGFrame::Init(nsIContent* aContent, AddStateBits(NS_FRAME_IS_NONDISPLAY); } - nsSVGOuterSVGFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow); nsIDocument* doc = mContent->GetUncomposedDoc(); if (doc) { @@ -141,11 +141,10 @@ nsSVGOuterSVGFrame::Init(nsIContent* aContent, NS_QUERYFRAME_HEAD(nsSVGOuterSVGFrame) NS_QUERYFRAME_ENTRY(nsISVGSVGFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGOuterSVGFrameBase) +NS_QUERYFRAME_TAIL_INHERITING(nsSVGDisplayContainerFrame) //---------------------------------------------------------------------- // nsIFrame methods - //---------------------------------------------------------------------- // reflowing @@ -276,7 +275,7 @@ nsSVGOuterSVGFrame::GetIntrinsicRatio() NSToCoordRoundWithClamp(viewBoxHeight)); } - return nsSVGOuterSVGFrameBase::GetIntrinsicRatio(); + return nsSVGDisplayContainerFrame::GetIntrinsicRatio(); } /* virtual */ @@ -508,7 +507,7 @@ nsSVGOuterSVGFrame::DidReflow(nsPresContext* aPresContext, const nsHTMLReflowState* aReflowState, nsDidReflowStatus aStatus) { - nsSVGOuterSVGFrameBase::DidReflow(aPresContext,aReflowState,aStatus); + nsSVGDisplayContainerFrame::DidReflow(aPresContext,aReflowState,aStatus); // Make sure elements styled by :hover get updated if script/animation moves // them under or out from under the pointer: diff --git a/layout/svg/nsSVGOuterSVGFrame.h b/layout/svg/nsSVGOuterSVGFrame.h index eadcf3dc3a71..b8a5fded6d2a 100644 --- a/layout/svg/nsSVGOuterSVGFrame.h +++ b/layout/svg/nsSVGOuterSVGFrame.h @@ -17,10 +17,8 @@ class nsSVGForeignObjectFrame; //////////////////////////////////////////////////////////////////////// // nsSVGOuterSVGFrame class -typedef nsSVGDisplayContainerFrame nsSVGOuterSVGFrameBase; - -class nsSVGOuterSVGFrame final : public nsSVGOuterSVGFrameBase, - public nsISVGSVGFrame +class nsSVGOuterSVGFrame final : public nsSVGDisplayContainerFrame + , public nsISVGSVGFrame { friend nsContainerFrame* NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); From 1f0bced7333ff189d1d89ab065316ba5b71372c8 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:34:12 +0800 Subject: [PATCH 76/93] Bug 1264837 Part 33 - Remove nsSVGOuterSVGAnonChildFrameBase. r=dholbert MozReview-Commit-ID: 4hnGGYnAjDh --HG-- extra : rebase_source : d40a06b4d23d4aa1a5a3314cafc54e3f93712311 --- layout/svg/nsSVGOuterSVGFrame.cpp | 2 +- layout/svg/nsSVGOuterSVGFrame.h | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/layout/svg/nsSVGOuterSVGFrame.cpp b/layout/svg/nsSVGOuterSVGFrame.cpp index 45c9edb9e6ae..bbe235d83be5 100644 --- a/layout/svg/nsSVGOuterSVGFrame.cpp +++ b/layout/svg/nsSVGOuterSVGFrame.cpp @@ -955,7 +955,7 @@ nsSVGOuterSVGAnonChildFrame::Init(nsIContent* aContent, { MOZ_ASSERT(aParent->GetType() == nsGkAtoms::svgOuterSVGFrame, "Unexpected parent"); - nsSVGOuterSVGAnonChildFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow); } #endif diff --git a/layout/svg/nsSVGOuterSVGFrame.h b/layout/svg/nsSVGOuterSVGFrame.h index b8a5fded6d2a..58237eb549dc 100644 --- a/layout/svg/nsSVGOuterSVGFrame.h +++ b/layout/svg/nsSVGOuterSVGFrame.h @@ -207,8 +207,6 @@ protected: //////////////////////////////////////////////////////////////////////// // nsSVGOuterSVGAnonChildFrame class -typedef nsSVGDisplayContainerFrame nsSVGOuterSVGAnonChildFrameBase; - /** * nsSVGOuterSVGFrames have a single direct child that is an instance of this * class, and which is used to wrap their real child frames. Such anonymous @@ -232,15 +230,14 @@ typedef nsSVGDisplayContainerFrame nsSVGOuterSVGAnonChildFrameBase; * example, the implementations of IsSVGTransformed and GetCanvasTM assume * nsSVGContainerFrame instances all the way up to the nsSVGOuterSVGFrame. */ -class nsSVGOuterSVGAnonChildFrame - : public nsSVGOuterSVGAnonChildFrameBase +class nsSVGOuterSVGAnonChildFrame : public nsSVGDisplayContainerFrame { friend nsContainerFrame* NS_NewSVGOuterSVGAnonChildFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); explicit nsSVGOuterSVGAnonChildFrame(nsStyleContext* aContext) - : nsSVGOuterSVGAnonChildFrameBase(aContext) + : nsSVGDisplayContainerFrame(aContext) {} public: From 1ee36846505789e8093309ca28671e4cd243287b Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:36:49 +0800 Subject: [PATCH 77/93] Bug 1264837 Part 34 - Remove nsSVGPaintServerFrameBase. r=dholbert MozReview-Commit-ID: JV6YsHX8VMV --HG-- extra : rebase_source : 7fc23a88cb46eefd373a08898fbedfaa40c346fb --- layout/svg/nsSVGPaintServerFrame.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/layout/svg/nsSVGPaintServerFrame.h b/layout/svg/nsSVGPaintServerFrame.h index caf6a82164f3..6b568f872742 100644 --- a/layout/svg/nsSVGPaintServerFrame.h +++ b/layout/svg/nsSVGPaintServerFrame.h @@ -26,15 +26,13 @@ class nsStyleContext; struct gfxRect; -typedef nsSVGContainerFrame nsSVGPaintServerFrameBase; - -class nsSVGPaintServerFrame : public nsSVGPaintServerFrameBase +class nsSVGPaintServerFrame : public nsSVGContainerFrame { protected: typedef mozilla::gfx::DrawTarget DrawTarget; explicit nsSVGPaintServerFrame(nsStyleContext* aContext) - : nsSVGPaintServerFrameBase(aContext) + : nsSVGContainerFrame(aContext) { AddStateBits(NS_FRAME_IS_NONDISPLAY); } @@ -65,7 +63,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return nsSVGPaintServerFrameBase::IsFrameOfType(aFlags & ~nsIFrame::eSVGPaintServer); + return nsSVGContainerFrame::IsFrameOfType(aFlags & ~nsIFrame::eSVGPaintServer); } }; From 40eb55de275e69ec607aebface9ad9f926b49c0c Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:38:47 +0800 Subject: [PATCH 78/93] Bug 1264837 Part 35 - Remove nsSVGPathGeometryFrameBase. r=dholbert MozReview-Commit-ID: 65TI0SnEXax --HG-- extra : rebase_source : 94a5f99dc750e344c632f3ceac93e55370bae076 --- layout/svg/nsSVGPathGeometryFrame.cpp | 6 +++--- layout/svg/nsSVGPathGeometryFrame.h | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/layout/svg/nsSVGPathGeometryFrame.cpp b/layout/svg/nsSVGPathGeometryFrame.cpp index 83099f1cce5d..04392f46cc97 100644 --- a/layout/svg/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/nsSVGPathGeometryFrame.cpp @@ -50,7 +50,7 @@ NS_IMPL_FRAMEARENA_HELPERS(nsSVGPathGeometryFrame) NS_QUERYFRAME_HEAD(nsSVGPathGeometryFrame) NS_QUERYFRAME_ENTRY(nsISVGChildFrame) NS_QUERYFRAME_ENTRY(nsSVGPathGeometryFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGPathGeometryFrameBase) +NS_QUERYFRAME_TAIL_INHERITING(nsFrame) //---------------------------------------------------------------------- // Display list item: @@ -123,7 +123,7 @@ nsSVGPathGeometryFrame::Init(nsIContent* aContent, nsIFrame* aPrevInFlow) { AddStateBits(aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD); - nsSVGPathGeometryFrameBase::Init(aContent, aParent, aPrevInFlow); + nsFrame::Init(aContent, aParent, aPrevInFlow); } nsresult @@ -150,7 +150,7 @@ nsSVGPathGeometryFrame::AttributeChanged(int32_t aNameSpaceID, /* virtual */ void nsSVGPathGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) { - nsSVGPathGeometryFrameBase::DidSetStyleContext(aOldStyleContext); + nsFrame::DidSetStyleContext(aOldStyleContext); if (aOldStyleContext) { auto oldStyleEffects = aOldStyleContext->PeekStyleEffects(); diff --git a/layout/svg/nsSVGPathGeometryFrame.h b/layout/svg/nsSVGPathGeometryFrame.h index ac895db9c3ab..d1764f685a4c 100644 --- a/layout/svg/nsSVGPathGeometryFrame.h +++ b/layout/svg/nsSVGPathGeometryFrame.h @@ -32,10 +32,8 @@ class nsSVGMarkerProperty; struct nsRect; -typedef nsFrame nsSVGPathGeometryFrameBase; - -class nsSVGPathGeometryFrame : public nsSVGPathGeometryFrameBase, - public nsISVGChildFrame +class nsSVGPathGeometryFrame : public nsFrame + , public nsISVGChildFrame { typedef mozilla::gfx::DrawTarget DrawTarget; @@ -46,7 +44,7 @@ class nsSVGPathGeometryFrame : public nsSVGPathGeometryFrameBase, protected: explicit nsSVGPathGeometryFrame(nsStyleContext* aContext) - : nsSVGPathGeometryFrameBase(aContext) + : nsFrame(aContext) { AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_MAY_BE_TRANSFORMED); } @@ -63,7 +61,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return nsSVGPathGeometryFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGGeometry)); + return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGGeometry)); } virtual nsresult AttributeChanged(int32_t aNameSpaceID, From de476c597f747e3ca5a7eb080e3406e94ce3101d Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:40:29 +0800 Subject: [PATCH 79/93] Bug 1264837 Part 36 - Remove nsSVGPatternFrameBase. r=dholbert MozReview-Commit-ID: 73NKQiyorGS --HG-- extra : rebase_source : aa9ef59b7b2ece3a04b88e718e88eab187ad256f --- layout/svg/nsSVGPatternFrame.cpp | 12 ++++++------ layout/svg/nsSVGPatternFrame.h | 4 +--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/layout/svg/nsSVGPatternFrame.cpp b/layout/svg/nsSVGPatternFrame.cpp index b07b73e9fcf6..dbb5c83ea7ff 100644 --- a/layout/svg/nsSVGPatternFrame.cpp +++ b/layout/svg/nsSVGPatternFrame.cpp @@ -55,10 +55,10 @@ private: //---------------------------------------------------------------------- // Implementation -nsSVGPatternFrame::nsSVGPatternFrame(nsStyleContext* aContext) : - nsSVGPatternFrameBase(aContext), - mLoopFlag(false), - mNoHRefURI(false) +nsSVGPatternFrame::nsSVGPatternFrame(nsStyleContext* aContext) + : nsSVGPaintServerFrame(aContext) + , mLoopFlag(false) + , mNoHRefURI(false) { } @@ -94,7 +94,7 @@ nsSVGPatternFrame::AttributeChanged(int32_t aNameSpaceID, nsSVGEffects::InvalidateDirectRenderingObservers(this); } - return nsSVGPatternFrameBase::AttributeChanged(aNameSpaceID, + return nsSVGPaintServerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); } @@ -106,7 +106,7 @@ nsSVGPatternFrame::Init(nsIContent* aContent, { NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::pattern), "Content is not an SVG pattern"); - nsSVGPatternFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGPaintServerFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ diff --git a/layout/svg/nsSVGPatternFrame.h b/layout/svg/nsSVGPatternFrame.h index ed832a591c60..4e2b358eb130 100644 --- a/layout/svg/nsSVGPatternFrame.h +++ b/layout/svg/nsSVGPatternFrame.h @@ -22,13 +22,11 @@ class SVGAnimatedPreserveAspectRatio; class nsSVGAnimatedTransformList; } // namespace mozilla -typedef nsSVGPaintServerFrame nsSVGPatternFrameBase; - /** * Patterns can refer to other patterns. We create an nsSVGPaintingProperty * with property type nsGkAtoms::href to track the referenced pattern. */ -class nsSVGPatternFrame : public nsSVGPatternFrameBase +class nsSVGPatternFrame : public nsSVGPaintServerFrame { typedef mozilla::gfx::SourceSurface SourceSurface; From e5872bf0fb15b78209274aa9665457d712b7c7ca Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:42:05 +0800 Subject: [PATCH 80/93] Bug 1264837 Part 37 - Remove nsSVGStopFrameBase. r=dholbert MozReview-Commit-ID: 9rukuVgOrMm --HG-- extra : rebase_source : 67a6b4ac31277e552a9d8f09ae142c1e2dd6069a --- layout/svg/nsSVGStopFrame.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/layout/svg/nsSVGStopFrame.cpp b/layout/svg/nsSVGStopFrame.cpp index 7997160420bd..1b75fa1028ac 100644 --- a/layout/svg/nsSVGStopFrame.cpp +++ b/layout/svg/nsSVGStopFrame.cpp @@ -14,15 +14,13 @@ // events and propagate them to the parent. Most of the heavy lifting is done // within the nsSVGGradientFrame, which is the parent for this frame -typedef nsFrame nsSVGStopFrameBase; - -class nsSVGStopFrame : public nsSVGStopFrameBase +class nsSVGStopFrame : public nsFrame { friend nsIFrame* NS_NewSVGStopFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: explicit nsSVGStopFrame(nsStyleContext* aContext) - : nsSVGStopFrameBase(aContext) + : nsFrame(aContext) { AddStateBits(NS_FRAME_IS_NONDISPLAY); } @@ -54,7 +52,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return nsSVGStopFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG)); + return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG)); } #ifdef DEBUG_FRAME_DUMP @@ -81,7 +79,7 @@ nsSVGStopFrame::Init(nsIContent* aContent, { NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::stop), "Content is not a stop element"); - nsSVGStopFrameBase::Init(aContent, aParent, aPrevInFlow); + nsFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ @@ -104,8 +102,7 @@ nsSVGStopFrame::AttributeChanged(int32_t aNameSpaceID, nsSVGEffects::InvalidateDirectRenderingObservers(GetParent()); } - return nsSVGStopFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); } // ------------------------------------------------------------------------- From f1b3bc79b99a61e296512e3453e7e633aa6e937e Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:43:07 +0800 Subject: [PATCH 81/93] Bug 1264837 Part 38 - Remove nsSVGSwitchFrameBase. r=dholbert MozReview-Commit-ID: K7LxDjF7XHY --HG-- extra : rebase_source : 7ea2e05ab0b8ac77c6e2d5a2b28745cf2047e06d --- layout/svg/nsSVGSwitchFrame.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/layout/svg/nsSVGSwitchFrame.cpp b/layout/svg/nsSVGSwitchFrame.cpp index a0f447ca7fe8..2a35e0f528a2 100644 --- a/layout/svg/nsSVGSwitchFrame.cpp +++ b/layout/svg/nsSVGSwitchFrame.cpp @@ -12,15 +12,13 @@ using namespace mozilla::gfx; -typedef nsSVGGFrame nsSVGSwitchFrameBase; - -class nsSVGSwitchFrame : public nsSVGSwitchFrameBase +class nsSVGSwitchFrame : public nsSVGGFrame { friend nsIFrame* NS_NewSVGSwitchFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: - explicit nsSVGSwitchFrame(nsStyleContext* aContext) : - nsSVGSwitchFrameBase(aContext) {} + explicit nsSVGSwitchFrame(nsStyleContext* aContext) + : nsSVGGFrame(aContext) {} public: NS_DECL_FRAMEARENA_HELPERS @@ -83,7 +81,7 @@ nsSVGSwitchFrame::Init(nsIContent* aContent, NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::svgSwitch), "Content is not an SVG switch"); - nsSVGSwitchFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGGFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ From 8b871e4c4fc6c992ca6cf52346f237f1454b723c Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:46:09 +0800 Subject: [PATCH 82/93] Bug 1264837 Part 39 - Remove nsSVGUseFrameBase. r=dholbert MozReview-Commit-ID: CJoLvBLPsIp --HG-- extra : rebase_source : efcdb546f9c6b9f3c295c61c867ff4d007c8796b --- layout/svg/nsSVGUseFrame.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/layout/svg/nsSVGUseFrame.cpp b/layout/svg/nsSVGUseFrame.cpp index c0f14c51fb8c..5c15ade4230f 100644 --- a/layout/svg/nsSVGUseFrame.cpp +++ b/layout/svg/nsSVGUseFrame.cpp @@ -10,27 +10,24 @@ #include "mozilla/dom/SVGUseElement.h" #include "nsContentList.h" -typedef nsSVGGFrame nsSVGUseFrameBase; - using namespace mozilla::dom; -class nsSVGUseFrame : public nsSVGUseFrameBase, - public nsIAnonymousContentCreator +class nsSVGUseFrame : public nsSVGGFrame + , public nsIAnonymousContentCreator { friend nsIFrame* NS_NewSVGUseFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: - explicit nsSVGUseFrame(nsStyleContext* aContext) : - nsSVGUseFrameBase(aContext), - mHasValidDimensions(true) + explicit nsSVGUseFrame(nsStyleContext* aContext) + : nsSVGGFrame(aContext) + , mHasValidDimensions(true) {} public: NS_DECL_QUERYFRAME NS_DECL_FRAMEARENA_HELPERS - // nsIFrame interface: virtual void Init(nsIContent* aContent, nsContainerFrame* aParent, @@ -93,7 +90,7 @@ nsSVGUseFrame::GetType() const NS_QUERYFRAME_HEAD(nsSVGUseFrame) NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) -NS_QUERYFRAME_TAIL_INHERITING(nsSVGUseFrameBase) +NS_QUERYFRAME_TAIL_INHERITING(nsSVGGFrame) //---------------------------------------------------------------------- // nsIFrame methods: @@ -109,7 +106,7 @@ nsSVGUseFrame::Init(nsIContent* aContent, mHasValidDimensions = static_cast(aContent)->HasValidDimensions(); - nsSVGUseFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGGFrame::Init(aContent, aParent, aPrevInFlow); } nsresult @@ -159,15 +156,14 @@ nsSVGUseFrame::AttributeChanged(int32_t aNameSpaceID, useElement->TriggerReclone(); } - return nsSVGUseFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + return nsSVGGFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); } void nsSVGUseFrame::DestroyFrom(nsIFrame* aDestructRoot) { RefPtr use = static_cast(mContent); - nsSVGUseFrameBase::DestroyFrom(aDestructRoot); + nsSVGGFrame::DestroyFrom(aDestructRoot); use->DestroyAnonymousContent(); } @@ -200,7 +196,7 @@ nsSVGUseFrame::ReflowSVG() InvalidateFrame(); } - nsSVGUseFrameBase::ReflowSVG(); + nsSVGGFrame::ReflowSVG(); } void @@ -228,7 +224,7 @@ nsSVGUseFrame::NotifySVGChanged(uint32_t aFlags) // non-percentage width/height, since if they're set then they are cloned to // an anonymous child , and its nsSVGInnerSVGFrame will do that. - nsSVGUseFrameBase::NotifySVGChanged(aFlags); + nsSVGGFrame::NotifySVGChanged(aFlags); } //---------------------------------------------------------------------- From e306f863808554a765e4151e38c0ac45bd679a51 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:47:37 +0800 Subject: [PATCH 83/93] Bug 1264837 Part 40 - Remove SVGFEContainerFrameBase. r=dholbert MozReview-Commit-ID: HOISrUkVbdt --HG-- extra : rebase_source : b4e2fc7563674537b9d13bdbd412a35d85c0bf21 --- layout/svg/SVGFEContainerFrame.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/layout/svg/SVGFEContainerFrame.cpp b/layout/svg/SVGFEContainerFrame.cpp index 699676efbb03..f1914e5d7558 100644 --- a/layout/svg/SVGFEContainerFrame.cpp +++ b/layout/svg/SVGFEContainerFrame.cpp @@ -11,19 +11,17 @@ #include "nsSVGEffects.h" #include "nsSVGFilters.h" -typedef nsContainerFrame SVGFEContainerFrameBase; - /* * This frame is used by filter primitive elements that * have special child elements that provide parameters. */ -class SVGFEContainerFrame : public SVGFEContainerFrameBase +class SVGFEContainerFrame : public nsContainerFrame { friend nsIFrame* NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: explicit SVGFEContainerFrame(nsStyleContext* aContext) - : SVGFEContainerFrameBase(aContext) + : nsContainerFrame(aContext) { AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY); } @@ -33,7 +31,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return SVGFEContainerFrameBase::IsFrameOfType( + return nsContainerFrame::IsFrameOfType( aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGContainer)); } @@ -84,7 +82,7 @@ SVGFEContainerFrame::Init(nsIContent* aContent, "Trying to construct an SVGFEContainerFrame for a " "content element that doesn't support the right interfaces"); - SVGFEContainerFrameBase::Init(aContent, aParent, aPrevInFlow); + nsContainerFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ @@ -106,6 +104,5 @@ SVGFEContainerFrame::AttributeChanged(int32_t aNameSpaceID, nsSVGEffects::InvalidateDirectRenderingObservers(GetParent()); } - return SVGFEContainerFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); } From edcf624a82b301603ca460122d5dd96701722e41 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:49:07 +0800 Subject: [PATCH 84/93] Bug 1264837 Part 41 - Remove SVGFEImageFrameBase. r=dholbert MozReview-Commit-ID: Dvff6q8ESvs --HG-- extra : rebase_source : f24408a767982fc7898ae10761d6df6b49f56cb1 --- layout/svg/SVGFEImageFrame.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/layout/svg/SVGFEImageFrame.cpp b/layout/svg/SVGFEImageFrame.cpp index 09ba055c5e02..5dbe9d93cdd1 100644 --- a/layout/svg/SVGFEImageFrame.cpp +++ b/layout/svg/SVGFEImageFrame.cpp @@ -16,15 +16,13 @@ using namespace mozilla; using namespace mozilla::dom; -typedef nsFrame SVGFEImageFrameBase; - -class SVGFEImageFrame : public SVGFEImageFrameBase +class SVGFEImageFrame : public nsFrame { friend nsIFrame* NS_NewSVGFEImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: explicit SVGFEImageFrame(nsStyleContext* aContext) - : SVGFEImageFrameBase(aContext) + : nsFrame(aContext) { AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY); @@ -45,7 +43,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return SVGFEImageFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG)); + return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG)); } #ifdef DEBUG_FRAME_DUMP @@ -89,12 +87,12 @@ SVGFEImageFrame::DestroyFrom(nsIFrame* aDestructRoot) DecApproximateVisibleCount(); nsCOMPtr imageLoader = - do_QueryInterface(SVGFEImageFrameBase::mContent); + do_QueryInterface(nsFrame::mContent); if (imageLoader) { imageLoader->FrameDestroyed(this); } - SVGFEImageFrameBase::DestroyFrom(aDestructRoot); + nsFrame::DestroyFrom(aDestructRoot); } void @@ -106,13 +104,13 @@ SVGFEImageFrame::Init(nsIContent* aContent, "Trying to construct an SVGFEImageFrame for a " "content element that doesn't support the right interfaces"); - SVGFEImageFrameBase::Init(aContent, aParent, aPrevInFlow); + nsFrame::Init(aContent, aParent, aPrevInFlow); // We assume that feImage's are always visible. IncApproximateVisibleCount(); nsCOMPtr imageLoader = - do_QueryInterface(SVGFEImageFrameBase::mContent); + do_QueryInterface(nsFrame::mContent); if (imageLoader) { imageLoader->FrameCreated(this); } @@ -144,8 +142,7 @@ SVGFEImageFrame::AttributeChanged(int32_t aNameSpaceID, } } - return SVGFEImageFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); } void @@ -153,14 +150,14 @@ SVGFEImageFrame::OnVisibilityChange(Visibility aNewVisibility, Maybe aNonvisibleAction) { nsCOMPtr imageLoader = - do_QueryInterface(SVGFEImageFrameBase::mContent); + do_QueryInterface(nsFrame::mContent); if (!imageLoader) { MOZ_ASSERT_UNREACHABLE("Should have an nsIImageLoadingContent"); - SVGFEImageFrameBase::OnVisibilityChange(aNewVisibility, aNonvisibleAction); + nsFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction); return; } imageLoader->OnVisibilityChange(aNewVisibility, aNonvisibleAction); - SVGFEImageFrameBase::OnVisibilityChange(aNewVisibility, aNonvisibleAction); + nsFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction); } From f17395df8bcc27ba9ef5d889f42949c6b2e0a35a Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:50:08 +0800 Subject: [PATCH 85/93] Bug 1264837 Part 42 - Remove SVGFELeafFrameBase. r=dholbert MozReview-Commit-ID: H40idRvWopf --HG-- extra : rebase_source : b13c255342473ef0df78fcf60c4df823b468cb12 --- layout/svg/SVGFELeafFrame.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/layout/svg/SVGFELeafFrame.cpp b/layout/svg/SVGFELeafFrame.cpp index 95ff719a2df5..3d6c765a7c8b 100644 --- a/layout/svg/SVGFELeafFrame.cpp +++ b/layout/svg/SVGFELeafFrame.cpp @@ -10,19 +10,17 @@ #include "nsSVGEffects.h" #include "nsSVGFilters.h" -typedef nsFrame SVGFELeafFrameBase; - /* * This frame is used by filter primitive elements that don't * have special child elements that provide parameters. */ -class SVGFELeafFrame : public SVGFELeafFrameBase +class SVGFELeafFrame : public nsFrame { friend nsIFrame* NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: explicit SVGFELeafFrame(nsStyleContext* aContext) - : SVGFELeafFrameBase(aContext) + : nsFrame(aContext) { AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY); } @@ -38,7 +36,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return SVGFELeafFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG)); + return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG)); } #ifdef DEBUG_FRAME_DUMP @@ -83,7 +81,7 @@ SVGFELeafFrame::Init(nsIContent* aContent, "Trying to construct an SVGFELeafFrame for a " "content element that doesn't support the right interfaces"); - SVGFELeafFrameBase::Init(aContent, aParent, aPrevInFlow); + nsFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ @@ -105,6 +103,5 @@ SVGFELeafFrame::AttributeChanged(int32_t aNameSpaceID, nsSVGEffects::InvalidateDirectRenderingObservers(GetParent()); } - return SVGFELeafFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); } From 9429decf037f2cad11567672f1c8614f81a4b537 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:52:31 +0800 Subject: [PATCH 86/93] Bug 1264837 Part 43 - Remove SVGFEUnstyledLeafFrameBase. r=dholbert MozReview-Commit-ID: JORpKHrdiRW --HG-- extra : rebase_source : 0a5b41ba129309e10606bca9e5997a5c76bd2fe6 --- layout/svg/SVGFEUnstyledLeafFrame.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/layout/svg/SVGFEUnstyledLeafFrame.cpp b/layout/svg/SVGFEUnstyledLeafFrame.cpp index ec252705136a..f3e92263f042 100644 --- a/layout/svg/SVGFEUnstyledLeafFrame.cpp +++ b/layout/svg/SVGFEUnstyledLeafFrame.cpp @@ -10,15 +10,13 @@ #include "nsSVGEffects.h" #include "nsSVGFilters.h" -typedef nsFrame SVGFEUnstyledLeafFrameBase; - -class SVGFEUnstyledLeafFrame : public SVGFEUnstyledLeafFrameBase +class SVGFEUnstyledLeafFrame : public nsFrame { friend nsIFrame* NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: explicit SVGFEUnstyledLeafFrame(nsStyleContext* aContext) - : SVGFEUnstyledLeafFrameBase(aContext) + : nsFrame(aContext) { AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY); } @@ -32,7 +30,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return SVGFEUnstyledLeafFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG)); + return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG)); } #ifdef DEBUG_FRAME_DUMP @@ -85,6 +83,5 @@ SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID, nsSVGEffects::InvalidateDirectRenderingObservers(GetParent()->GetParent()); } - return SVGFEUnstyledLeafFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); } From 0890d2766a6ce78ae12cf65076331041c1fb7d27 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:54:36 +0800 Subject: [PATCH 87/93] Bug 1264837 Part 44 - Remove SVGTextFrameBase. r=dholbert MozReview-Commit-ID: J6Kcpqm3ot8 --HG-- extra : rebase_source : 9ffb2804ff3950fe4e93f252a4536dc85f75a292 --- layout/svg/SVGTextFrame.cpp | 6 +++--- layout/svg/SVGTextFrame.h | 12 +++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp index d699bbae1d62..d2cda7df6364 100644 --- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -3209,7 +3209,7 @@ nsDisplaySVGText::Paint(nsDisplayListBuilder* aBuilder, NS_QUERYFRAME_HEAD(SVGTextFrame) NS_QUERYFRAME_ENTRY(SVGTextFrame) -NS_QUERYFRAME_TAIL_INHERITING(SVGTextFrameBase) +NS_QUERYFRAME_TAIL_INHERITING(nsSVGDisplayContainerFrame) // --------------------------------------------------------------------- // Implementation @@ -3232,7 +3232,7 @@ SVGTextFrame::Init(nsIContent* aContent, { NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::text), "Content is not an SVG text"); - SVGTextFrameBase::Init(aContent, aParent, aPrevInFlow); + nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow); AddStateBits((aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) | NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_SVG_TEXT); @@ -3926,7 +3926,7 @@ SVGTextFrame::ReflowSVG() // XXX nsSVGContainerFrame::ReflowSVG only looks at its nsISVGChildFrame // children, and calls ConsiderChildOverflow on them. Does it matter // that ConsiderChildOverflow won't be called on our children? - SVGTextFrameBase::ReflowSVG(); + nsSVGDisplayContainerFrame::ReflowSVG(); } /** diff --git a/layout/svg/SVGTextFrame.h b/layout/svg/SVGTextFrame.h index 20e54220234a..84cc0caccbf5 100644 --- a/layout/svg/SVGTextFrame.h +++ b/layout/svg/SVGTextFrame.h @@ -22,8 +22,6 @@ class nsDisplaySVGText; class SVGTextFrame; class nsTextFrame; -typedef nsSVGDisplayContainerFrame SVGTextFrameBase; - namespace mozilla { class CharIterator; @@ -245,7 +243,7 @@ public: * itself do the painting. Otherwise, a DrawPathCallback is passed to * PaintText so that we can fill the text geometry with SVG paint servers. */ -class SVGTextFrame final : public SVGTextFrameBase +class SVGTextFrame final : public nsSVGDisplayContainerFrame { friend nsIFrame* NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); @@ -267,10 +265,10 @@ class SVGTextFrame final : public SVGTextFrameBase protected: explicit SVGTextFrame(nsStyleContext* aContext) - : SVGTextFrameBase(aContext), - mFontSizeScaleFactor(1.0f), - mLastContextScale(1.0f), - mLengthAdjustScaleFactor(1.0f) + : nsSVGDisplayContainerFrame(aContext) + , mFontSizeScaleFactor(1.0f) + , mLastContextScale(1.0f) + , mLengthAdjustScaleFactor(1.0f) { AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY); } From 2792ab700c133ae42b3f12f388955791aadb789d Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 18 Apr 2016 15:57:01 +0800 Subject: [PATCH 88/93] Bug 1264837 Part 45 - Remove SVGViewFrameBase. r=dholbert MozReview-Commit-ID: HynJLTOM7ic --HG-- extra : rebase_source : cace67ef5b04fff01be3f77cb1037bb4ced1d1c1 --- layout/svg/SVGViewFrame.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/layout/svg/SVGViewFrame.cpp b/layout/svg/SVGViewFrame.cpp index 256f6ed9eb5a..ff876f3eb798 100644 --- a/layout/svg/SVGViewFrame.cpp +++ b/layout/svg/SVGViewFrame.cpp @@ -10,8 +10,6 @@ #include "mozilla/dom/SVGSVGElement.h" #include "mozilla/dom/SVGViewElement.h" -typedef nsFrame SVGViewFrameBase; - using namespace mozilla::dom; /** @@ -20,13 +18,13 @@ using namespace mozilla::dom; * identifier. The SVGViewFrame class passes on any attribute changes * the view receives to the overridden element (if there is one). **/ -class SVGViewFrame : public SVGViewFrameBase +class SVGViewFrame : public nsFrame { friend nsIFrame* NS_NewSVGViewFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); protected: explicit SVGViewFrame(nsStyleContext* aContext) - : SVGViewFrameBase(aContext) + : nsFrame(aContext) { AddStateBits(NS_FRAME_IS_NONDISPLAY); } @@ -42,7 +40,7 @@ public: virtual bool IsFrameOfType(uint32_t aFlags) const override { - return SVGViewFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG)); + return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG)); } #ifdef DEBUG_FRAME_DUMP @@ -86,7 +84,7 @@ SVGViewFrame::Init(nsIContent* aContent, NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::view), "Content is not an SVG view"); - SVGViewFrameBase::Init(aContent, aParent, aPrevInFlow); + nsFrame::Init(aContent, aParent, aPrevInFlow); } #endif /* DEBUG */ @@ -125,6 +123,5 @@ SVGViewFrame::AttributeChanged(int32_t aNameSpaceID, } } - return SVGViewFrameBase::AttributeChanged(aNameSpaceID, - aAttribute, aModType); + return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); } From 3b81e9dd7d90e0385a781d034de62ad6af0a9a32 Mon Sep 17 00:00:00 2001 From: Sotaro Ikeda Date: Mon, 18 Apr 2016 20:12:41 -0700 Subject: [PATCH 89/93] Bug 1262278 - Rename PlanarYCbCrImage::SetData and PlanarYCbCrImage::SetDataNoCopy r=nical --- dom/camera/GonkCameraControl.cpp | 2 +- dom/media/MediaData.cpp | 6 +++--- dom/media/MediaStreamGraph.cpp | 2 +- dom/media/VideoSegment.cpp | 4 ++-- dom/media/android/AndroidMediaReader.cpp | 2 +- dom/media/gtest/TestVideoTrackEncoder.cpp | 6 +++--- dom/media/omx/OMXCodecWrapper.cpp | 2 +- dom/media/webrtc/MediaEngineDefault.cpp | 2 +- dom/media/webrtc/MediaEngineGonkVideoSource.cpp | 4 ++-- dom/media/webrtc/MediaEngineRemoteVideoSource.cpp | 2 +- gfx/layers/GrallocImages.cpp | 2 +- gfx/layers/GrallocImages.h | 3 ++- gfx/layers/ImageContainer.cpp | 8 +------- gfx/layers/ImageContainer.h | 14 ++++---------- gfx/layers/basic/BasicImages.cpp | 6 +++--- gfx/layers/ipc/SharedPlanarYCbCrImage.cpp | 6 +++--- gfx/layers/ipc/SharedPlanarYCbCrImage.h | 4 ++-- .../src/media-conduit/WebrtcOMXH264VideoCodec.cpp | 6 +++--- .../signaling/src/mediapipeline/MediaPipeline.cpp | 2 +- 19 files changed, 36 insertions(+), 47 deletions(-) diff --git a/dom/camera/GonkCameraControl.cpp b/dom/camera/GonkCameraControl.cpp index 280a77391c08..4f5e6f225ebc 100644 --- a/dom/camera/GonkCameraControl.cpp +++ b/dom/camera/GonkCameraControl.cpp @@ -2382,7 +2382,7 @@ nsGonkCameraControl::OnNewPreviewFrame(layers::TextureClient* aBuffer) IntSize picSize(mCurrentConfiguration.mPreviewSize.width, mCurrentConfiguration.mPreviewSize.height); - frame->SetData(aBuffer, picSize); + frame->AdoptData(aBuffer, picSize); if (mCapturePoster.exchange(false)) { CreatePoster(frame, diff --git a/dom/media/MediaData.cpp b/dom/media/MediaData.cpp index 8b3e8ff69e82..2f845812b590 100644 --- a/dom/media/MediaData.cpp +++ b/dom/media/MediaData.cpp @@ -247,9 +247,9 @@ bool VideoData::SetVideoDataToImage(PlanarYCbCrImage* aVideoImage, aVideoImage->SetDelayedConversion(true); if (aCopyData) { - return aVideoImage->SetData(data); + return aVideoImage->CopyData(data); } else { - return aVideoImage->SetDataNoCopy(data); + return aVideoImage->AdoptData(data); } } @@ -480,7 +480,7 @@ VideoData::Create(const VideoInfo& aInfo, 0)); RefPtr image = new layers::GrallocImage(); - image->SetData(aBuffer, aPicture.Size()); + image->AdoptData(aBuffer, aPicture.Size()); v->mImage = image; return v.forget(); diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index 9994336df25a..a38000f58a17 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -890,7 +890,7 @@ SetImageToBlackPixel(PlanarYCbCrImage* aImage) data.mCrChannel = blackPixel + 2; data.mYStride = data.mCbCrStride = 1; data.mPicSize = data.mYSize = data.mCbCrSize = IntSize(1, 1); - aImage->SetData(data); + aImage->CopyData(data); } class VideoFrameContainerInvalidateRunnable : public nsRunnable { diff --git a/dom/media/VideoSegment.cpp b/dom/media/VideoSegment.cpp index 48fa78eb1058..83555e8b4f25 100644 --- a/dom/media/VideoSegment.cpp +++ b/dom/media/VideoSegment.cpp @@ -79,8 +79,8 @@ VideoFrame::CreateBlackImage(const gfx::IntSize& aSize) data.mPicSize = gfx::IntSize(aSize.width, aSize.height); data.mStereoMode = StereoMode::MONO; - // SetData copies data, so we can free data. - if (!image->SetData(data)) { + // Copies data, so we can free data. + if (!image->CopyData(data)) { MOZ_ASSERT(false); return nullptr; } diff --git a/dom/media/android/AndroidMediaReader.cpp b/dom/media/android/AndroidMediaReader.cpp index 34d3c5b4a8f1..1b8658e346d1 100644 --- a/dom/media/android/AndroidMediaReader.cpp +++ b/dom/media/android/AndroidMediaReader.cpp @@ -421,7 +421,7 @@ AndroidMediaReader::ImageBufferCallback::CreateI420Image(size_t aWidth, frameDesc.mPicY = 0; frameDesc.mPicSize = IntSize(aWidth, aHeight); - yuvImage->SetDataNoCopy(frameDesc); + yuvImage->AdoptData(frameDesc); return buffer; } diff --git a/dom/media/gtest/TestVideoTrackEncoder.cpp b/dom/media/gtest/TestVideoTrackEncoder.cpp index ab742e4d990c..b0b79a89f18a 100644 --- a/dom/media/gtest/TestVideoTrackEncoder.cpp +++ b/dom/media/gtest/TestVideoTrackEncoder.cpp @@ -87,7 +87,7 @@ private: data.mCbCrSize.width = halfWidth; data.mCbCrSize.height = halfHeight; - image->SetData(data); + image->CopyData(data); return image; } @@ -124,7 +124,7 @@ private: data.mCbCrSize.width = halfWidth; data.mCbCrSize.height = halfHeight; - image->SetData(data); + image->CopyData(data); return image; } @@ -161,7 +161,7 @@ private: data.mCbCrSize.width = halfWidth; data.mCbCrSize.height = halfHeight; - image->SetData(data); + image->CopyData(data); return image; } diff --git a/dom/media/omx/OMXCodecWrapper.cpp b/dom/media/omx/OMXCodecWrapper.cpp index b6e3f566bab0..9d696d1b9dd2 100644 --- a/dom/media/omx/OMXCodecWrapper.cpp +++ b/dom/media/omx/OMXCodecWrapper.cpp @@ -489,7 +489,7 @@ OMXVideoEncoder::Encode(const Image* aImage, int aWidth, int aHeight, NS_ENSURE_TRUE(aWidth == size.width, NS_ERROR_INVALID_ARG); NS_ENSURE_TRUE(aHeight == size.height, NS_ERROR_INVALID_ARG); if (format == ImageFormat::PLANAR_YCBCR) { - // Test for data, allowing SetDataNoCopy() on an image without an mBuffer + // Test for data, allowing AdoptData() on an image without an mBuffer // (as used from WebrtcOMXH264VideoCodec, and a few other places) - bug 1067442 const PlanarYCbCrData* yuv = static_cast(img)->GetData(); NS_ENSURE_TRUE(yuv->mYChannel, NS_ERROR_INVALID_ARG); diff --git a/dom/media/webrtc/MediaEngineDefault.cpp b/dom/media/webrtc/MediaEngineDefault.cpp index 9a9bd9fd3390..2c631831f1d9 100644 --- a/dom/media/webrtc/MediaEngineDefault.cpp +++ b/dom/media/webrtc/MediaEngineDefault.cpp @@ -251,7 +251,7 @@ MediaEngineDefaultVideoSource::Notify(nsITimer* aTimer) 0, 0); #endif - bool setData = ycbcr_image->SetData(data); + bool setData = ycbcr_image->CopyData(data); MOZ_ASSERT(setData); // SetData copies data, so we can free the frame diff --git a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp index f31d06de72ae..4550f29ce846 100644 --- a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp @@ -789,7 +789,7 @@ MediaEngineGonkVideoSource::RotateImage(layers::Image* aImage, uint32_t aWidth, libyuv::FOURCC_NV21); destBuffer->unlock(); - image->AsGrallocImage()->SetData(textureClient, gfx::IntSize(dstWidth, dstHeight)); + image->AsGrallocImage()->AdoptData(textureClient, gfx::IntSize(dstWidth, dstHeight)); } else { // Handle out of gralloc case. image = mImageContainer->CreatePlanarYCbCrImage(); @@ -821,7 +821,7 @@ MediaEngineGonkVideoSource::RotateImage(layers::Image* aImage, uint32_t aWidth, data.mPicSize = IntSize(dstWidth, dstHeight); data.mStereoMode = StereoMode::MONO; - image->AsPlanarYCbCrImage()->SetDataNoCopy(data); + image->AsPlanarYCbCrImage()->AdoptData(data); } graphicBuffer->unlock(); diff --git a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp index b3c48c8e74d9..ebccc4936611 100644 --- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp @@ -342,7 +342,7 @@ MediaEngineRemoteVideoSource::DeliverFrame(unsigned char* buffer, data.mPicSize = IntSize(mWidth, mHeight); data.mStereoMode = StereoMode::MONO; - if (!image->SetData(data)) { + if (!image->CopyData(data)) { MOZ_ASSERT(false); return 0; } diff --git a/gfx/layers/GrallocImages.cpp b/gfx/layers/GrallocImages.cpp index 8c3f1de1d99b..52633c09b10e 100644 --- a/gfx/layers/GrallocImages.cpp +++ b/gfx/layers/GrallocImages.cpp @@ -144,7 +144,7 @@ GrallocImage::SetData(const Data& aData) } void -GrallocImage::SetData(TextureClient* aGraphicBuffer, const gfx::IntSize& aSize) +GrallocImage::AdoptData(TextureClient* aGraphicBuffer, const gfx::IntSize& aSize) { mTextureClient = aGraphicBuffer; mSize = aSize; diff --git a/gfx/layers/GrallocImages.h b/gfx/layers/GrallocImages.h index 5c40e8742be1..c32e71eba591 100644 --- a/gfx/layers/GrallocImages.h +++ b/gfx/layers/GrallocImages.h @@ -63,11 +63,12 @@ public: */ virtual bool SetData(const Data& aData); + using RecyclingPlanarYCbCrImage::AdoptData; /** * Share the SurfaceDescriptor without making the copy, in order * to support functioning in all different layer managers. */ - void SetData(TextureClient* aGraphicBuffer, const gfx::IntSize& aSize); + void AdoptData(TextureClient* aGraphicBuffer, const gfx::IntSize& aSize); // From [android 4.0.4]/hardware/msm7k/libgralloc-qsd8k/gralloc_priv.h enum { diff --git a/gfx/layers/ImageContainer.cpp b/gfx/layers/ImageContainer.cpp index 8762033309ed..ed1d4621142f 100644 --- a/gfx/layers/ImageContainer.cpp +++ b/gfx/layers/ImageContainer.cpp @@ -534,12 +534,6 @@ RecyclingPlanarYCbCrImage::CopyData(const Data& aData) return true; } -bool -RecyclingPlanarYCbCrImage::SetData(const Data &aData) -{ - return CopyData(aData); -} - gfxImageFormat PlanarYCbCrImage::GetOffscreenFormat() { @@ -549,7 +543,7 @@ PlanarYCbCrImage::GetOffscreenFormat() } bool -PlanarYCbCrImage::SetDataNoCopy(const Data &aData) +PlanarYCbCrImage::AdoptData(const Data &aData) { mData = aData; mSize = aData.mPicSize; diff --git a/gfx/layers/ImageContainer.h b/gfx/layers/ImageContainer.h index 28882577f934..6e7dcedaa337 100644 --- a/gfx/layers/ImageContainer.h +++ b/gfx/layers/ImageContainer.h @@ -727,16 +727,16 @@ public: * This makes a copy of the data buffers, in order to support functioning * in all different layer managers. */ - virtual bool SetData(const Data& aData) = 0; + virtual bool CopyData(const Data& aData) = 0; /** * This doesn't make a copy of the data buffers. Can be used when mBuffer is - * pre allocated with AllocateAndGetNewBuffer(size) and then SetDataNoCopy is + * pre allocated with AllocateAndGetNewBuffer(size) and then AdoptData is * called to only update the picture size, planes etc. fields in mData. * The GStreamer media backend uses this to decode into PlanarYCbCrImage(s) * directly. */ - virtual bool SetDataNoCopy(const Data &aData); + virtual bool AdoptData(const Data &aData); /** * This allocates and returns a new buffer @@ -793,16 +793,10 @@ class RecyclingPlanarYCbCrImage: public PlanarYCbCrImage { public: explicit RecyclingPlanarYCbCrImage(BufferRecycleBin *aRecycleBin) : mRecycleBin(aRecycleBin) {} virtual ~RecyclingPlanarYCbCrImage() override; - virtual bool SetData(const Data& aData) override; + virtual bool CopyData(const Data& aData) override; virtual uint8_t* AllocateAndGetNewBuffer(uint32_t aSize) override; virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override; protected: - /** - * Make a copy of the YCbCr data into local storage. - * - * @param aData Input image data. - */ - bool CopyData(const Data& aData); /** * Return a buffer to store image data in. diff --git a/gfx/layers/basic/BasicImages.cpp b/gfx/layers/basic/BasicImages.cpp index 73592f532da5..43f408073e67 100644 --- a/gfx/layers/basic/BasicImages.cpp +++ b/gfx/layers/basic/BasicImages.cpp @@ -49,7 +49,7 @@ public: } } - virtual bool SetData(const Data& aData) override; + virtual bool CopyData(const Data& aData) override; virtual void SetDelayedConversion(bool aDelayed) override { mDelayedConversion = aDelayed; } already_AddRefed GetAsSourceSurface() override; @@ -86,9 +86,9 @@ public: }; bool -BasicPlanarYCbCrImage::SetData(const Data& aData) +BasicPlanarYCbCrImage::CopyData(const Data& aData) { - RecyclingPlanarYCbCrImage::SetData(aData); + RecyclingPlanarYCbCrImage::CopyData(aData); if (mDelayedConversion) { return false; diff --git a/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp b/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp index aa2c3bbe698e..13c7746c0d82 100644 --- a/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp +++ b/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp @@ -82,7 +82,7 @@ SharedPlanarYCbCrImage::GetAsSourceSurface() } bool -SharedPlanarYCbCrImage::SetData(const PlanarYCbCrData& aData) +SharedPlanarYCbCrImage::CopyData(const PlanarYCbCrData& aData) { // If mTextureClient has not already been allocated (through Allocate(aData)) // allocate it. This code path is slower than the one used when Allocate has @@ -140,9 +140,9 @@ SharedPlanarYCbCrImage::AllocateAndGetNewBuffer(uint32_t aSize) } bool -SharedPlanarYCbCrImage::SetDataNoCopy(const Data &aData) +SharedPlanarYCbCrImage::AdoptData(const Data &aData) { - // SetDataNoCopy is used to update YUV plane offsets without (re)allocating + // AdoptData is used to update YUV plane offsets without (re)allocating // memory previously allocated with AllocateAndGetNewBuffer(). MOZ_ASSERT(mTextureClient, "This Image should have already allocated data"); diff --git a/gfx/layers/ipc/SharedPlanarYCbCrImage.h b/gfx/layers/ipc/SharedPlanarYCbCrImage.h index d15071fc1c4f..ecdca1bd30fb 100644 --- a/gfx/layers/ipc/SharedPlanarYCbCrImage.h +++ b/gfx/layers/ipc/SharedPlanarYCbCrImage.h @@ -34,8 +34,8 @@ public: virtual uint8_t* GetBuffer() override; virtual already_AddRefed GetAsSourceSurface() override; - virtual bool SetData(const PlanarYCbCrData& aData) override; - virtual bool SetDataNoCopy(const Data &aData) override; + virtual bool CopyData(const PlanarYCbCrData& aData) override; + virtual bool AdoptData(const Data &aData) override; virtual bool Allocate(PlanarYCbCrData& aData); virtual uint8_t* AllocateAndGetNewBuffer(uint32_t aSize) override; diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp index 4291ebd184ba..7bb03370e43f 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp @@ -529,7 +529,7 @@ public: gfx::IntSize picSize(buffer->GetSize()); nsAutoPtr grallocImage(new layers::GrallocImage()); - grallocImage->SetData(buffer, picSize); + grallocImage->AdoptData(buffer, picSize); // Get timestamp of the frame about to render. int64_t timestamp = -1; @@ -1004,8 +1004,8 @@ WebrtcOMXH264VideoEncoder::Encode(const webrtc::I420VideoFrame& aInputImage, yuvData.mPicSize = yuvData.mYSize; yuvData.mStereoMode = StereoMode::MONO; layers::RecyclingPlanarYCbCrImage img(nullptr); - // SetDataNoCopy() doesn't need AllocateAndGetNewBuffer(); OMXVideoEncoder is ok with this - img.SetDataNoCopy(yuvData); + // AdoptData() doesn't need AllocateAndGetNewBuffer(); OMXVideoEncoder is ok with this + img.AdoptData(yuvData); CODEC_LOGD("Encode frame: %dx%d, timestamp %u (%lld), renderTimeMs %" PRIu64, aInputImage.width(), aInputImage.height(), diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp index 43735737d3b9..357b1db72052 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp @@ -2234,7 +2234,7 @@ public: yuvData.mPicSize = IntSize(width_, height_); yuvData.mStereoMode = StereoMode::MONO; - if (!yuvImage->SetData(yuvData)) { + if (!yuvImage->CopyData(yuvData)) { MOZ_ASSERT(false); return; } From 644959b4eb64af3ed7b0a0d3e6f55a72d427e84f Mon Sep 17 00:00:00 2001 From: CJKu Date: Tue, 19 Apr 2016 10:55:20 +0800 Subject: [PATCH 90/93] Bug 1231643 - Part 1. Create skia-A8-surface for mask composition when backendtype of the source DrawTarget is CG; r=mstange MozReview-Commit-ID: J0oIhhTowk7 --HG-- extra : rebase_source : 0825caa3824a369d4a59a2ed8dc1c877bb4b0509 --- layout/svg/nsSVGIntegrationUtils.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp index b7b4ae757ed9..1b2c8b586245 100644 --- a/layout/svg/nsSVGIntegrationUtils.cpp +++ b/layout/svg/nsSVGIntegrationUtils.cpp @@ -567,7 +567,17 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext, clipRect = aContext.GetClipExtents(); } IntRect drawRect = RoundedOut(ToRect(clipRect)); - RefPtr targetDT = aContext.GetDrawTarget()->CreateSimilarDrawTarget(drawRect.Size(), SurfaceFormat::A8); + + // Mask composition result on CoreGraphic::A8 surface is not correct + // when mask-mode is not add(source over). Switch to skia when CG backend + // detected. + RefPtr targetDT = + (aContext.GetDrawTarget()->GetBackendType() == BackendType::COREGRAPHICS) ? + Factory::CreateDrawTarget(BackendType::SKIA, drawRect.Size(), + SurfaceFormat::A8) : + aContext.GetDrawTarget()->CreateSimilarDrawTarget(drawRect.Size(), + SurfaceFormat::A8); + if (!targetDT || !targetDT->IsValid()) { aContext.Restore(); return; From 346962e28105a2bc517d78495361dd1b4b544e27 Mon Sep 17 00:00:00 2001 From: CJKu Date: Tue, 19 Apr 2016 10:55:32 +0800 Subject: [PATCH 91/93] Bug 1231643 - Part 2. Enable mask-composite reftest; r=dbaron MozReview-Commit-ID: J5ruSOg9K80 --HG-- extra : rebase_source : f859a5d774f332bcd0e6d71687dc8129d21efdb3 --- layout/reftests/w3c-css/submitted/masking/reftest.list | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layout/reftests/w3c-css/submitted/masking/reftest.list b/layout/reftests/w3c-css/submitted/masking/reftest.list index 3c050194f351..aec678bc100d 100644 --- a/layout/reftests/w3c-css/submitted/masking/reftest.list +++ b/layout/reftests/w3c-css/submitted/masking/reftest.list @@ -5,8 +5,8 @@ # mask-composite test cases fails == mask-composite-1a.html mask-composite-1-ref.html fails == mask-composite-1b.html mask-composite-1-ref.html -fails fails-if(cocoaWidget) == mask-composite-2a.html mask-composite-2-ref.html # bug 1231643; -fails fails-if(cocoaWidget) == mask-composite-2b.html mask-composite-2-ref.html # bug 1231643; +fails == mask-composite-2a.html mask-composite-2-ref.html +fails == mask-composite-2b.html mask-composite-2-ref.html # mask-mode test cases fails == mask-mode-a.html mask-mode-ref.html From 0c0bc852302c8b76a47bbd3966a8e38259e6cb30 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Tue, 5 Jan 2016 18:35:23 +0100 Subject: [PATCH 92/93] Bug 1263975 - XUL scrollbox (e.g. the tab bar) should respond to pixel scrolls by pixel scrolling. r=Enn MozReview-Commit-ID: FWSBkg9wM7r --HG-- extra : amend_source : a872853f6801635cb695738658d8ffb0ba26d39b --- toolkit/content/widgets/scrollbox.xml | 29 ++++++++++++++------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/toolkit/content/widgets/scrollbox.xml b/toolkit/content/widgets/scrollbox.xml index 51dffdc2c031..ede284ae7de0 100644 --- a/toolkit/content/widgets/scrollbox.xml +++ b/toolkit/content/widgets/scrollbox.xml @@ -497,12 +497,12 @@ - + <handler event="wheel"><![CDATA[ if (this.orient == "vertical") { - // prevent horizontal scrolling from scrolling a vertical scrollbox - if (event.axis == event.HORIZONTAL_AXIS) - return; - this.scrollByIndex(event.detail); + if (event.deltaMode == event.DOM_DELTA_PIXEL) + this.scrollByPixels(event.deltaY); + else + this.scrollByIndex(event.deltaY); } // We allow vertical scrolling to scroll a horizontal scrollbox // because many users have a vertical scroll wheel but no @@ -511,12 +511,18 @@ // and mouse wheels that support simultaneous scrolling in both axes. // We do this by scrolling only when the last two scroll events were // on the same axis as the current scroll event. + // For diagonal scroll events we only respect the dominant axis. else { - let isVertical = event.axis == event.VERTICAL_AXIS; + let isVertical = Math.abs(event.deltaY) > Math.abs(event.deltaX); + let delta = isVertical ? event.deltaY : event.deltaX; + let scrollByDelta = isVertical && this._isRTLScrollbox ? -delta : delta; - if (this._prevMouseScrolls.every(prev => prev == isVertical)) - this.scrollByIndex(isVertical && this._isRTLScrollbox ? -event.detail : - event.detail); + if (this._prevMouseScrolls.every(prev => prev == isVertical)) { + if (event.deltaMode == event.DOM_DELTA_PIXEL) + this.scrollByPixels(scrollByDelta); + else + this.scrollByIndex(scrollByDelta); + } if (this._prevMouseScrolls.length > 1) this._prevMouseScrolls.shift(); @@ -527,11 +533,6 @@ event.preventDefault(); - - event.stopPropagation(); - event.preventDefault(); - - // filter underflow events which were dispatched on nested scrollboxes if (event.target != this) From c355389ef86d2bb0f8882d180b0a194fc7a5cbc9 Mon Sep 17 00:00:00 2001 From: Markus Stange <mstange@themasta.com> Date: Fri, 15 Apr 2016 15:43:34 -0400 Subject: [PATCH 93/93] Bug 1263975 - Adjust test_mousescroll.xul for the new behavior. r=masayuki MozReview-Commit-ID: 4nCsUuIoPLs --HG-- extra : amend_source : 9534ba07b0a40234374a0813c9404a64ceea5ed4 --- .../content/tests/chrome/test_mousescroll.xul | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/toolkit/content/tests/chrome/test_mousescroll.xul b/toolkit/content/tests/chrome/test_mousescroll.xul index ebd4788b237f..91ccf56831d1 100644 --- a/toolkit/content/tests/chrome/test_mousescroll.xul +++ b/toolkit/content/tests/chrome/test_mousescroll.xul @@ -202,8 +202,9 @@ function testArrowScrollbox(id) var scrollBoxObject = scrollbox.scrollBoxObject; var orient = scrollbox.getAttribute("orient"); - function helper(aStart, aDelta, aIntDelta, aDeltaMode, aExpected) + function helper(aStart, aDelta, aDeltaMode, aExpected) { + var lineOrPageDelta = (aDeltaMode == WheelEvent.DOM_DELTA_PIXEL) ? aDelta / 10 : aDelta; var orientIsHorizontal = (orient == "horizontal"); scrollBoxObject.scrollTo(aStart, aStart); @@ -211,7 +212,7 @@ function testArrowScrollbox(id) for (var i = orientIsHorizontal ? 2 : 0; i >= 0; i--) { synthesizeWheel(scrollbox, 5, 5, { deltaMode: aDeltaMode, deltaY: aDelta, - lineOrPageDeltaY: aIntDelta }); + lineOrPageDeltaY: lineOrPageDelta }); var pos = orientIsHorizontal ? scrollBoxObject.positionX : scrollBoxObject.positionY; @@ -222,7 +223,7 @@ function testArrowScrollbox(id) let expected = !i ? aExpected : aStart; is(pos, expected, "testArrowScrollbox(" + id + "): vertical, starting " + aStart + - " delta " + aDelta + " lineOrPageDelta " + aIntDelta + + " delta " + aDelta + " lineOrPageDelta " + lineOrPageDelta + " aDeltaMode " + aDeltaMode); } @@ -230,7 +231,7 @@ function testArrowScrollbox(id) for (var i = orientIsHorizontal ? 2 : 0; i >= 0; i--) { synthesizeWheel(scrollbox, 5, 5, { deltaMode: aDeltaMode, deltaX: aDelta, - lineOrPageDeltaX: aIntDelta }); + lineOrPageDeltaX: lineOrPageDelta }); // horizontal mouse scrolling is never allowed to scroll vertical // arrowscrollboxes var pos = orientIsHorizontal ? scrollBoxObject.positionX : @@ -238,7 +239,7 @@ function testArrowScrollbox(id) let expected = (!i && orientIsHorizontal) ? aExpected : aStart; is(pos, expected, "testArrowScrollbox(" + id + "): horizontal, starting " + aStart + - " delta " + aDelta + " lineOrPageDelta " + aIntDelta + + " delta " + aDelta + " lineOrPageDelta " + lineOrPageDelta + " aDeltaMode " + aDeltaMode); } } @@ -250,13 +251,10 @@ function testArrowScrollbox(id) var scrollMax = orient == "horizontal" ? scrollMaxX : scrollMaxY; deltaModes.forEach(function(aDeltaMode) { - // These lineOrPageDelta values are not realistic. However, it's enough to - // test if it's scrolled by the lineOrPageDelta value. - let delta = (aDeltaMode == WheelEvent.DOM_DELTA_PIXEL) ? 5.0 : 0.3; - helper(50, -delta, -100, aDeltaMode, 0); - helper(50, delta, 100, aDeltaMode, scrollMax); - helper(50, -delta, 0, aDeltaMode, 50); - helper(50, delta, 0, aDeltaMode, 50); + helper(50, -1000, aDeltaMode, 0); + helper(50, 1000, aDeltaMode, scrollMax); + helper(50, 0, aDeltaMode, 50); + helper(50, 0, aDeltaMode, 50); }); }