diff --git a/dom/html/nsIFormProcessor.h b/dom/html/nsIFormProcessor.h index edc1fd10be75..ed868ee47f5d 100644 --- a/dom/html/nsIFormProcessor.h +++ b/dom/html/nsIFormProcessor.h @@ -52,9 +52,12 @@ public: * every form submission. * * @param aElement element which the attribute/value pair is submitted for - * @param aName value of the form element name attribute about to be submitted - * @param aValue On entry it contains the value about to be submitted for aName. - * On exit it contains the value which will actually be submitted for aName. + * @param aName value of the form element name attribute about to be + * submitted + * @param aValue On entry it contains the value about to be submitted + * for aName. + * On exit it contains the value which will actually be + * submitted for aName. * */ virtual nsresult ProcessValue(mozilla::dom::Element* aElement, @@ -75,8 +78,10 @@ public: * content which comes from a source other than the document (i.e. a local database) * * @param aFormType Type of form to get content for. - * @param aOptions List of nsStrings which define the contents for the form element - * @param aAttr Attribute to be attached to the form element. It is used to identify + * @param aOptions List of nsStrings which define the contents for the + * form element + * @param aAttr Attribute to be attached to the form element. It is + * used to identify * the form element contains non-standard content. */ diff --git a/dom/indexedDB/Key.cpp b/dom/indexedDB/Key.cpp index c4f041bdd877..430ee0ce3c07 100644 --- a/dom/indexedDB/Key.cpp +++ b/dom/indexedDB/Key.cpp @@ -53,7 +53,8 @@ namespace indexedDB { When encoding strings, we use variable-size encoding per the following table Chars 0 - 7E are encoded as 0xxxxxxx with 1 added - Chars 7F - (3FFF+7F) are encoded as 10xxxxxx xxxxxxxx with 7F subtracted + Chars 7F - (3FFF+7F) are encoded as 10xxxxxx xxxxxxxx with 7F + subtracted Chars (3FFF+80) - FFFF are encoded as 11xxxxxx xxxxxxxx xx000000 This ensures that the first byte is never encoded as 0, which means that the diff --git a/dom/media/DOMMediaStream.h b/dom/media/DOMMediaStream.h index 80d20f8c72ab..64f3b634f28b 100644 --- a/dom/media/DOMMediaStream.h +++ b/dom/media/DOMMediaStream.h @@ -152,7 +152,8 @@ class Pledge; * * DOMStream A * Input Owned Playback - * t1 ---------> t1 <- MediaStreamTrack X (removed) + * t1 ---------> t1 <- MediaStreamTrack X + * (removed) * (pointing to t1 in A) * t2 ---------> t2 ------------> t2 <- MediaStreamTrack Y * \ (pointing to t2 in A) @@ -160,7 +161,8 @@ class Pledge; * \ / (pointing to t1 in B) * DOMStream B \ / * Input \ Owned / Playback - * t1 ---^-----> t1 --- <- MediaStreamTrack Z (removed) + * t1 ---^-----> t1 --- <- MediaStreamTrack Z + * (removed) * \ \ (pointing to t1 in B) * \ \ * DOMStream A' \ \ diff --git a/dom/media/webaudio/blink/DynamicsCompressorKernel.cpp b/dom/media/webaudio/blink/DynamicsCompressorKernel.cpp index c09b775450f2..83c7e1a60f9b 100644 --- a/dom/media/webaudio/blink/DynamicsCompressorKernel.cpp +++ b/dom/media/webaudio/blink/DynamicsCompressorKernel.cpp @@ -276,7 +276,8 @@ void DynamicsCompressorKernel::process(float* sourceChannels[], float y4 = releaseFrames * releaseZone4; // All of these coefficients were derived for 4th order polynomial curve fitting where the y values - // match the evenly spaced x values as follows: (y1 : x == 0, y2 : x == 1, y3 : x == 2, y4 : x == 3) + // match the evenly spaced x values as follows: + // (y1 : x == 0, y2 : x == 1, y3 : x == 2, y4 : x == 3) float kA = 0.9999999999999998f*y1 + 1.8432219684323923e-16f*y2 - 1.9373394351676423e-16f*y3 + 8.824516011816245e-18f*y4; float kB = -1.5788320352845888f*y1 + 2.3305837032074286f*y2 - 0.9141194204840429f*y3 + 0.1623677525612032f*y4; float kC = 0.5334142869106424f*y1 - 1.272736789213631f*y2 + 0.9258856042207512f*y3 - 0.18656310191776226f*y4; diff --git a/dom/media/webaudio/blink/HRTFDatabase.h b/dom/media/webaudio/blink/HRTFDatabase.h index f15e1d60309e..ea8059f4aaa4 100644 --- a/dom/media/webaudio/blink/HRTFDatabase.h +++ b/dom/media/webaudio/blink/HRTFDatabase.h @@ -42,10 +42,12 @@ class HRTFDatabase { public: static nsReturnRef create(float sampleRate); + // clang-format off // getKernelsFromAzimuthElevation() returns a left and right ear kernel, and an interpolated left and right frame delay for the given azimuth and elevation. // azimuthBlend must be in the range 0 -> 1. // Valid values for azimuthIndex are 0 -> HRTFElevation::NumberOfTotalAzimuths - 1 (corresponding to angles of 0 -> 360). // Valid values for elevationAngle are MinElevation -> MaxElevation. + // clang-format on void getKernelsFromAzimuthElevation(double azimuthBlend, unsigned azimuthIndex, double elevationAngle, HRTFKernel* &kernelL, HRTFKernel* &kernelR, double& frameDelayL, double& frameDelayR); // Returns the number of different azimuth angles. diff --git a/dom/media/webaudio/blink/HRTFKernel.h b/dom/media/webaudio/blink/HRTFKernel.h index c9bd97ec9fa5..140adbd39625 100644 --- a/dom/media/webaudio/blink/HRTFKernel.h +++ b/dom/media/webaudio/blink/HRTFKernel.h @@ -43,7 +43,8 @@ using mozilla::FFTBlock; // HRTFKernel is a frequency-domain representation of an impulse-response used as part of the spatialized panning system. // For a given azimuth / elevation angle there will be one HRTFKernel for the left ear transfer function, and one for the right ear. // The leading delay (average group delay) for each impulse response is extracted: -// m_fftFrame is the frequency-domain representation of the impulse response with the delay removed +// m_fftFrame is the frequency-domain representation of the impulse +// response with the delay removed // m_frameDelay is the leading delay of the original impulse response. class HRTFKernel { public: diff --git a/dom/media/webaudio/blink/IIRFilter.cpp b/dom/media/webaudio/blink/IIRFilter.cpp index 992d7bfaacd5..f30b603f6749 100644 --- a/dom/media/webaudio/blink/IIRFilter.cpp +++ b/dom/media/webaudio/blink/IIRFilter.cpp @@ -117,7 +117,8 @@ void IIRFilter::getFrequencyResponse(int nFrequencies, const float* frequency, f // // H(z) = sum(b[k]*z^(-k), k, 0, M) / sum(a[k]*z^(-k), k, 0, N); // - // The desired frequency response is H(exp(j*omega)), where omega is in [0, 1). + // The desired frequency response is H(exp(j*omega)), where omega is in + // [0, 1). // // Let P(x) = sum(c[k]*x^k, k, 0, P) be a polynomial of order P. Then each of the sums in H(z) // is equivalent to evaluating a polynomial at the point 1/z. diff --git a/dom/plugins/base/npapi.h b/dom/plugins/base/npapi.h index bec12b42d61c..5e8635542de9 100644 --- a/dom/plugins/base/npapi.h +++ b/dom/plugins/base/npapi.h @@ -63,6 +63,7 @@ #define NP_VERSION_MINOR 29 +/* clang-format off */ /* The OS/2 version of Netscape uses RC_DATA to define the mime types, file extensions, etc that are required. Use a vertical bar to separate types, end types with \0. @@ -88,6 +89,7 @@ RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\ RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" } RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" } */ +/* clang-format on */ /* RC_DATA types for version info - required */ #define NP_INFO_ProductVersion 1 #define NP_INFO_MIMEType 2 diff --git a/dom/plugins/base/nsPluginLogging.h b/dom/plugins/base/nsPluginLogging.h index b29bf1952c76..542c70047150 100644 --- a/dom/plugins/base/nsPluginLogging.h +++ b/dom/plugins/base/nsPluginLogging.h @@ -31,8 +31,9 @@ // 2. You can combine logs and levels by separating them with a comma: // My favorite Win32 Example: SET MOZ_LOG=Plugin:5,PluginNPP:5,PluginNPN:5 -// 3. Instead of output going to the console, you can log to a file. Additionally, set the -// MOZ_LOG_FILE environment variable to point to the full path of a file. +// 3. Instead of output going to the console, you can log to a file. +// Additionally, set the MOZ_LOG_FILE environment variable to point to the +// full path of a file. // My favorite Win32 Example: SET MOZ_LOG_FILE=c:\temp\pluginLog.txt // 4. For complete information see the Gecko Developer guide: diff --git a/dom/plugins/ipc/FunctionBroker.h b/dom/plugins/ipc/FunctionBroker.h index 471dd7172db2..f6561c34db97 100644 --- a/dom/plugins/ipc/FunctionBroker.h +++ b/dom/plugins/ipc/FunctionBroker.h @@ -54,7 +54,8 @@ * Use a subclass instead of a typedef if you need to maintain data or state. * * Step 2: Add an instance of that object to the FunctionHookList in - * AddFunctionHook(FunctionHookList&) or AddBrokeredFunctionHook(FunctionHookList&). + * AddFunctionHook(FunctionHookList&) or + * AddBrokeredFunctionHook(FunctionHookList&). * This typically just means calling the constructor with the correct info. * At a minimum, this means supplying the names of the DLL and method to * broker, and a pointer to the original version of the method. @@ -81,7 +82,9 @@ * parameters are sent/returned. This example tells InternetWriteFileFB to * return its third parameter: * template<> template<> - * struct InternetWriteFileFB::Response::Info::ShouldMarshal<3> { static const bool value = true; }; + * struct InternetWriteFileFB::Response::Info::ShouldMarshal<3> { + * static const bool value = true; + * }; * By default, all parameters have ShouldMarshal set in the request phase * and only the return value (parameter -1) has it set in the response phase. * @@ -113,13 +116,16 @@ * length. Something like: * * typedef RequestHandler HookedFuncDelegateReq; + * int HOOK_CALL (nsDependentCSubstring)> + * HookedFuncDelegateReq; * * template<> - * void HookedFuncFB::Request::Marshal(IpdlTuple& aTuple, const void*& aBuf, const int& aBufLen) + * void HookedFuncFB::Request::Marshal(IpdlTuple& aTuple, const void*& aBuf, + * const int& aBufLen) * { * MOZ_ASSERT(nWritten); - * HookedFuncDelegateReq::Marshal(aTuple, nsDependentCSubstring(aBuf, aBufLen)); + * HookedFuncDelegateReq::Marshal(aTuple, + * nsDependentCSubstring(aBuf, aBufLen)); * } * * template<> diff --git a/dom/plugins/test/testplugin/nptest.cpp b/dom/plugins/test/testplugin/nptest.cpp index 047558289b50..238ebc5a5812 100644 --- a/dom/plugins/test/testplugin/nptest.cpp +++ b/dom/plugins/test/testplugin/nptest.cpp @@ -2456,7 +2456,8 @@ convertPointY(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVaria static bool streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result) { - // .streamTest(url, doPost, postData, writeCallback, notifyCallback, redirectCallback, allowRedirects, postFile = false) + // .streamTest(url, doPost, postData, writeCallback, notifyCallback, + // redirectCallback, allowRedirects, postFile = false) if (!(7 <= argCount && argCount <= 8)) return false; diff --git a/dom/presentation/PresentationSessionInfo.cpp b/dom/presentation/PresentationSessionInfo.cpp index 7a7e0f88ebca..9999fce8125e 100644 --- a/dom/presentation/PresentationSessionInfo.cpp +++ b/dom/presentation/PresentationSessionInfo.cpp @@ -1144,7 +1144,8 @@ PresentationControllingInfo::NotifyData(const nsACString& aData, bool aIsBinary) * During presentation session establishment, the receiver expects the following * after trying to launch the app by notifying "presentation-launch-receiver": * (The order between step 2 and 3 is not guaranteed.) - * 1. |Observe| of |nsIObserver| is called with "presentation-receiver-launched". + * 1. |Observe| of |nsIObserver| is called with + * "presentation-receiver-launched". * Then start listen to document |STATE_TRANSFERRING| event. * 2. |NotifyResponderReady| is called to indicate the receiver page is ready * for presentation use. diff --git a/dom/promise/PromiseWorkerProxy.h b/dom/promise/PromiseWorkerProxy.h index 94dfcb3f4e0a..9f5f46cc86bd 100644 --- a/dom/promise/PromiseWorkerProxy.h +++ b/dom/promise/PromiseWorkerProxy.h @@ -29,7 +29,8 @@ class WorkerPrivate; // 1. Create a Promise on the worker thread and return it to the content // script: // -// RefPtr promise = Promise::Create(workerPrivate->GlobalScope(), aRv); +// RefPtr promise = +// Promise::Create(workerPrivate->GlobalScope(), aRv); // if (aRv.Failed()) { // return nullptr; // } @@ -79,7 +80,8 @@ class WorkerPrivate; // worker. // // RefPtr runnable = -// new FinishTaskWorkerRunnable(proxy->GetWorkerPrivate(), proxy, result); +// new FinishTaskWorkerRunnable(proxy->GetWorkerPrivate(), proxy, +// result); // if (!r->Dispatch()) { // // Worker is alive but not Running any more, so the Promise can't // // be resolved, give up. The proxy will get Release()d at some diff --git a/dom/security/nsCSPContext.cpp b/dom/security/nsCSPContext.cpp index 2d35953216b3..76ba9aa45831 100644 --- a/dom/security/nsCSPContext.cpp +++ b/dom/security/nsCSPContext.cpp @@ -549,10 +549,12 @@ nsCSPContext::GetAllowsInline(nsContentPolicyType aContentType, * * @param violationType: the VIOLATION_TYPE_* constant (partial symbol) * such as INLINE_SCRIPT - * @param contentPolicyType: a constant from nsIContentPolicy such as TYPE_STYLESHEET + * @param contentPolicyType: a constant from nsIContentPolicy such as + * TYPE_STYLESHEET * @param nonceOrHash: for NONCE and HASH violations, it's the nonce or content * string. For other violations, it is an empty string. - * @param keyword: the keyword corresponding to violation (UNSAFE_INLINE for most) + * @param keyword: the keyword corresponding to violation (UNSAFE_INLINE for + * most) * @param observerTopic: the observer topic string to send with the CSP * observer notifications. * diff --git a/dom/security/nsCSPParser.h b/dom/security/nsCSPParser.h index 03d6c075657d..b0b274f5d63a 100644 --- a/dom/security/nsCSPParser.h +++ b/dom/security/nsCSPParser.h @@ -123,7 +123,8 @@ class nsCSPParser { * are stored in mTokens, for example: * mTokens = [ [ script-src, http://www.example.com, 'self' ], ... ] * - * When parsing starts, mCurdir always holds the currently processed array of strings. + * When parsing starts, mCurdir always holds the currently processed array of + * strings. * In our example: * mCurDir = [ script-src, http://www.example.com, 'self' ] * @@ -133,20 +134,22 @@ class nsCSPParser { * mCurToken = script-src * which allows to do simple string comparisons to see if mCurToken is a valid directive. * - * Continuing parsing, the parser consumes the next string of that array, resetting: + * Continuing parsing, the parser consumes the next string of that array, + * resetting: * mCurToken = "http://www.example.com" * ^ ^ * mCurChar mEndChar (points *after* the 'm') * mCurValue = "" * - * After calling advance() the first time, helpers would hold the following values: + * After calling advance() the first time, helpers would hold the following + * values: * mCurToken = "http://www.example.com" * ^ ^ * mCurChar mEndChar (points *after* the 'm') * mCurValue = "h" * - * We continue parsing till all strings of one directive are consumed, then we reset - * mCurDir to hold the next array of strings and start the process all over. + * We continue parsing till all strings of one directive are consumed, then we + * reset mCurDir to hold the next array of strings and start the process all over. */ const char16_t* mCurChar; diff --git a/dom/security/nsMixedContentBlocker.cpp b/dom/security/nsMixedContentBlocker.cpp index 6843636ead63..4d63f418c013 100644 --- a/dom/security/nsMixedContentBlocker.cpp +++ b/dom/security/nsMixedContentBlocker.cpp @@ -642,9 +642,10 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect, // In this case we use aRequestingLocation to set requestingLocation. // b) TYPE_CSP_REPORT which does not provide a context. In this case we // use aRequestingLocation to set requestingLocation. - // c) content scripts from addon code that do not provide aRequestingContext - // or aRequestingLocation, but do provide aRequestPrincipal. - // If aRequestPrincipal is an expanded principal, we allow the load. + // c) content scripts from addon code that do not provide + // aRequestingContext or aRequestingLocation, but do provide + // aRequestPrincipal. If aRequestPrincipal is an expanded principal, + // we allow the load. // 4) If we still end up not having a requestingLocation, we reject the load. nsCOMPtr principal; diff --git a/dom/security/test/gtest/TestCSPParser.cpp b/dom/security/test/gtest/TestCSPParser.cpp index c73ff8fc8f2d..6ae92b96f0c0 100644 --- a/dom/security/test/gtest/TestCSPParser.cpp +++ b/dom/security/test/gtest/TestCSPParser.cpp @@ -179,6 +179,7 @@ TEST(CSPParser, Directives) { static const PolicyTest policies[] = { + // clang-format off { "connect-src xn--mnchen-3ya.de", "connect-src http://xn--mnchen-3ya.de"}, { "default-src http://www.example.com", @@ -221,6 +222,7 @@ TEST(CSPParser, Directives) "worker-src https://example.com" }, { "worker-src http://worker.com; frame-src http://frame.com; child-src http://child.com", "worker-src http://worker.com; frame-src http://frame.com; child-src http://child.com" }, + // clang-format on }; uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest); @@ -233,6 +235,7 @@ TEST(CSPParser, Keywords) { static const PolicyTest policies[] = { + // clang-format off { "script-src 'self'", "script-src 'self'" }, { "script-src 'unsafe-inline'", @@ -245,18 +248,20 @@ TEST(CSPParser, Keywords) "script-src 'none'" }, { "img-src 'none'; script-src 'unsafe-eval' 'unsafe-inline'; default-src 'self'", "img-src 'none'; script-src 'unsafe-eval' 'unsafe-inline'; default-src 'self'" }, + // clang-format on }; uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest); ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1))); } -// ============================= TestIgnoreUpperLowerCasePolicies ======================== +// =================== TestIgnoreUpperLowerCasePolicies ============== TEST(CSPParser, IgnoreUpperLowerCasePolicies) { static const PolicyTest policies[] = { + // clang-format off { "script-src 'SELF'", "script-src 'self'" }, { "sCriPt-src 'Unsafe-Inline'", @@ -289,18 +294,20 @@ TEST(CSPParser, IgnoreUpperLowerCasePolicies) "sandbox allow-forms"}, { "require-SRI-for sCript stYle", "require-sri-for script style"}, + // clang-format on }; uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest); ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1))); } -// ============================= TestPaths ======================== +// ========================= TestPaths =============================== TEST(CSPParser, Paths) { static const PolicyTest policies[] = { + // clang-format off { "script-src http://www.example.com", "script-src http://www.example.com" }, { "script-src http://www.example.com/", @@ -387,18 +394,20 @@ TEST(CSPParser, Paths) "script-src http://www.example.com:88/.js" }, { "script-src https://foo.com/_abc/abc_/_/_a_b_c_", "script-src https://foo.com/_abc/abc_/_/_a_b_c_" } + // clang-format on }; uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest); ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1))); } -// ============================= TestSimplePolicies ======================== +// ======================== TestSimplePolicies ======================= TEST(CSPParser, SimplePolicies) { static const PolicyTest policies[] = { + // clang-format off { "default-src *", "default-src *" }, { "default-src https:", @@ -463,18 +472,20 @@ TEST(CSPParser, SimplePolicies) "upgrade-insecure-requests" }, { "sandbox allow-scripts allow-forms ", "sandbox allow-scripts allow-forms" }, + // clang-format on }; uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest); ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1))); } -// ============================= TestPoliciesWithInvalidSrc ======================== +// =================== TestPoliciesWithInvalidSrc ==================== TEST(CSPParser, PoliciesWithInvalidSrc) { static const PolicyTest policies[] = { + // clang-format off { "script-src 'self'; SCRIPT-SRC http://www.example.com", "script-src 'self'" }, { "script-src 'none' test.com; script-src example.com", @@ -557,6 +568,7 @@ TEST(CSPParser, PoliciesWithInvalidSrc) "require-sri-for script"}, { "sandbox foo", "sandbox"}, + // clang-format on }; // amount of tests - 1, because the latest should be ignored. @@ -564,12 +576,13 @@ TEST(CSPParser, PoliciesWithInvalidSrc) ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1))); } -// ============================= TestBadPolicies ======================== +// ============================= TestBadPolicies ======================= TEST(CSPParser, BadPolicies) { static const PolicyTest policies[] = { + // clang-format off { "script-sr 'self", "" }, { "", "" }, { "; ; ; ; ; ; ;", "" }, @@ -580,18 +593,20 @@ TEST(CSPParser, BadPolicies) { "require-sri-for foo", ""}, { "report-uri", ""}, { "report-uri http://:foo", ""}, + // clang-format on }; uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest); ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 0))); } -// ============================= TestGoodGeneratedPolicies ======================== +// ======================= TestGoodGeneratedPolicies ================= TEST(CSPParser, GoodGeneratedPolicies) { static const PolicyTest policies[] = { + // clang-format off { "default-src 'self'; img-src *", "default-src 'self'; img-src *" }, { "report-uri /policy", @@ -808,18 +823,20 @@ TEST(CSPParser, GoodGeneratedPolicies) "default-src 'self'; frame-ancestors 'self'" }, { "frame-ancestors http://bar.com/foo.png", "frame-ancestors http://bar.com/foo.png" }, + // clang-format on }; uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest); ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1))); } -// ============================= TestBadGeneratedPolicies ======================== +// ==================== TestBadGeneratedPolicies ==================== TEST(CSPParser, BadGeneratedPolicies) { static const PolicyTest policies[] = { + // clang-format off { "foo.*.bar", ""}, { "foo!bar.com", ""}, { "x.*.a.com", ""}, @@ -834,13 +851,14 @@ TEST(CSPParser, BadGeneratedPolicies) { "http://other:pass1@self.com/foo", ""}, { "http://user1:pass1@self.com/foo", ""}, { "http://username:password@self.com/bar", ""}, + // clang-format on }; uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest); ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 0))); } -// ============ TestGoodGeneratedPoliciesForPathHandling ============ +// ============ TestGoodGeneratedPoliciesForPathHandling ============= TEST(CSPParser, GoodGeneratedPoliciesForPathHandling) { @@ -849,6 +867,7 @@ TEST(CSPParser, GoodGeneratedPoliciesForPathHandling) static const PolicyTest policies[] = { + // clang-format off { "img-src http://test1.example.com", "img-src http://test1.example.com" }, { "img-src http://test1.example.com/", @@ -957,18 +976,20 @@ TEST(CSPParser, GoodGeneratedPoliciesForPathHandling) "img-src https://test1.example.com/abc////////////def/" }, { "img-src https://test1.example.com/abc////////////", "img-src https://test1.example.com/abc////////////" }, + // clang-format on }; uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest); ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1))); } -// ============ TestBadGeneratedPoliciesForPathHandling ============ +// ============== TestBadGeneratedPoliciesForPathHandling ============ TEST(CSPParser, BadGeneratedPoliciesForPathHandling) { static const PolicyTest policies[] = { + // clang-format off { "img-src test1.example.com:88path-1/", "img-src 'none'" }, { "img-src test1.example.com:80.js", @@ -983,13 +1004,14 @@ TEST(CSPParser, BadGeneratedPoliciesForPathHandling) "img-src 'none'" }, { "img-src http://test1.example.com:80abc", "img-src 'none'" }, + // clang-format on }; uint32_t policyCount = sizeof(policies) / sizeof(PolicyTest); ASSERT_TRUE(NS_SUCCEEDED(runTestSuite(policies, policyCount, 1))); } -// ============================= TestFuzzyPolicies ======================== +// ======================== TestFuzzyPolicies ======================== // Use a policy, eliminate one character at a time, // and feed it as input to the parser. @@ -1010,7 +1032,7 @@ TEST(CSPParser, ShorteningPolicies) } } -// ============================= TestFuzzyPolicies ======================== +// ============================= TestFuzzyPolicies =================== // We generate kFuzzyRuns inputs by (pseudo) randomly picking from the 128 // ASCII characters; feed them to the parser and verfy that the parser @@ -1045,7 +1067,7 @@ TEST(CSPParser, FuzzyPolicies) #endif -// ============================= TestFuzzyPoliciesIncDir ======================== +// ======================= TestFuzzyPoliciesIncDir =================== // In a similar fashion as in TestFuzzyPolicies, we again (pseudo) randomly // generate input for the parser, but this time also include a valid directive @@ -1085,7 +1107,7 @@ TEST(CSPParser, FuzzyPoliciesIncDir) #endif -// ============================= TestFuzzyPoliciesIncDirLimASCII ============== +// ====================== TestFuzzyPoliciesIncDirLimASCII ============ // Same as TestFuzzyPoliciesIncDir() but using limited ASCII, // which represents more likely input. diff --git a/dom/serviceworkers/ServiceWorkerManager.cpp b/dom/serviceworkers/ServiceWorkerManager.cpp index bab00c4defe3..880a818169e6 100644 --- a/dom/serviceworkers/ServiceWorkerManager.cpp +++ b/dom/serviceworkers/ServiceWorkerManager.cpp @@ -2757,12 +2757,12 @@ ServiceWorkerManager::RemoveRegistration(ServiceWorkerRegistrationInfo* aRegistr { // Note, we do not need to call mActor->SendUnregister() here. There are a few // ways we can get here: - // 1) Through a normal unregister which calls SendUnregister() in the unregister - // job Start() method. + // 1) Through a normal unregister which calls SendUnregister() in the + // unregister job Start() method. // 2) Through origin storage being purged. These result in ForceUnregister() // starting unregister jobs which in turn call SendUnregister(). - // 3) Through the failure to install a new service worker. Since we don't store - // the registration until install succeeds, we do not need to call + // 3) Through the failure to install a new service worker. Since we don't + // store the registration until install succeeds, we do not need to call // SendUnregister here. // Assert these conditions by testing for pending uninstall (cases 1 and 2) or // null workers (case 3). diff --git a/dom/websocket/WebSocket.h b/dom/websocket/WebSocket.h index 4dbaabd5fdbb..3c375cd91568 100644 --- a/dom/websocket/WebSocket.h +++ b/dom/websocket/WebSocket.h @@ -128,7 +128,8 @@ public: // WebIDL interface: // webIDL: readonly attribute DOMString protocol; void GetProtocol(nsAString& aResult); - // webIDL: void close(optional unsigned short code, optional DOMString reason): + // webIDL: void close(optional unsigned short code, + // optional DOMString reason): void Close(const Optional& aCode, const Optional& aReason, ErrorResult& aRv); diff --git a/dom/xbl/nsXBLBinding.cpp b/dom/xbl/nsXBLBinding.cpp index f97f83720c2d..0118823e2397 100644 --- a/dom/xbl/nsXBLBinding.cpp +++ b/dom/xbl/nsXBLBinding.cpp @@ -97,7 +97,7 @@ static const JSClass gPrototypeJSClass = { &gPrototypeJSClassOps }; -// Implementation ///////////////////////////////////////////////////////////////// +// Implementation ////////////////////////////////////////////////////////////// // Constructors/Destructors nsXBLBinding::nsXBLBinding(nsXBLPrototypeBinding* aBinding) @@ -808,7 +808,7 @@ nsXBLBinding::GetServoStyles() const return mPrototypeBinding->GetServoStyles(); } -// Internal helper methods //////////////////////////////////////////////////////////////// +// Internal helper methods ///////////////////////////////////////////////////// // Get or create a WeakMap object on a given XBL-hosting global. // diff --git a/dom/xbl/nsXBLPrototypeBinding.cpp b/dom/xbl/nsXBLPrototypeBinding.cpp index 9fe2e83d0b6e..016eb47c4127 100644 --- a/dom/xbl/nsXBLPrototypeBinding.cpp +++ b/dom/xbl/nsXBLPrototypeBinding.cpp @@ -52,7 +52,7 @@ using namespace mozilla; using namespace mozilla::dom; -// Helper Classes ===================================================================== +// Helper Classes ============================================================== // nsXBLAttributeEntry and helpers. This class is used to efficiently handle // attribute changes in anonymous content. @@ -105,7 +105,7 @@ nsXBLAttributeEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const // ============================================================================= -// Implementation ///////////////////////////////////////////////////////////////// +// Implementation ////////////////////////////////////////////////////////////// // Constructors/Destructors nsXBLPrototypeBinding::nsXBLPrototypeBinding() @@ -456,7 +456,7 @@ nsXBLPrototypeBinding::ImplementsInterface(REFNSIID aIID) const return !!mInterfaceTable.GetWeak(aIID); } -// Internal helpers /////////////////////////////////////////////////////////////////////// +// Internal helpers //////////////////////////////////////////////////////////// Element* nsXBLPrototypeBinding::GetImmediateChild(nsAtom* aTag) diff --git a/dom/xbl/nsXBLService.cpp b/dom/xbl/nsXBLService.cpp index 40c1e46b7da3..6ea26fcd791d 100644 --- a/dom/xbl/nsXBLService.cpp +++ b/dom/xbl/nsXBLService.cpp @@ -346,7 +346,7 @@ nsXBLStreamListener::HandleEvent(Event* aEvent) return rv; } -// Implementation ///////////////////////////////////////////////////////////////// +// Implementation ////////////////////////////////////////////////////////////// // Implement our nsISupports methods NS_IMPL_ISUPPORTS(nsXBLService, nsISupportsWeakReference) @@ -717,7 +717,7 @@ nsXBLService::DetachGlobalKeyHandler(EventTarget* aTarget) return NS_OK; } -// Internal helper methods //////////////////////////////////////////////////////////////// +// Internal helper methods ///////////////////////////////////////////////////// nsresult nsXBLService::BindingReady(nsIContent* aBoundElement, diff --git a/dom/xslt/base/txList.h b/dom/xslt/base/txList.h index 66c7893fad46..3662c9f21e10 100644 --- a/dom/xslt/base/txList.h +++ b/dom/xslt/base/txList.h @@ -135,7 +135,8 @@ public: void* remove(); /** - * Resets the current location within the txList to the beginning of the txList + * Resets the current location within the txList to the beginning of the + * txList **/ void reset(); diff --git a/dom/xslt/xpath/txBooleanResult.cpp b/dom/xslt/xpath/txBooleanResult.cpp index 8eb91bb8eb00..3e94289f5ef6 100644 --- a/dom/xslt/xpath/txBooleanResult.cpp +++ b/dom/xslt/xpath/txBooleanResult.cpp @@ -11,7 +11,8 @@ /** * Creates a new BooleanResult with the value of the given bool parameter - * @param boolean the bool to use for initialization of this BooleanResult's value + * @param boolean the bool to use for initialization of this BooleanResult's + * value **/ BooleanResult::BooleanResult(bool boolean) : txAExprResult(nullptr) diff --git a/editor/libeditor/HTMLEditorDocumentCommands.cpp b/editor/libeditor/HTMLEditorDocumentCommands.cpp index 91512306ca42..6729e991a4a1 100644 --- a/editor/libeditor/HTMLEditorDocumentCommands.cpp +++ b/editor/libeditor/HTMLEditorDocumentCommands.cpp @@ -567,7 +567,8 @@ SetDocumentStateCommand::GetCommandStateParams(const char* aCommandName, * 2. Implement an nsIObserve object, e.g: * * void Observe( - * in nsISupports aSubject, // The nsICommandManager calling this Observer + * in nsISupports aSubject, // The nsICommandManager calling this + * // Observer * in string aTopic, // command name, e.g.:"obs_documentCreated" * // or "obs_documentWillBeDestroyed" in wstring aData ); // ignored (set to "command_status_changed") @@ -578,7 +579,8 @@ SetDocumentStateCommand::GetCommandStateParams(const char* aCommandName, * trigger the notification of this observer by something like: * * nsCOMPtr commandManager = mDocShell->GetCommandManager(); - * nsCOMPtr commandUpdater = do_QueryInterface(commandManager); + * nsCOMPtr commandUpdater = + * do_QueryInterface(commandManager); * NS_ENSURE_TRUE(commandUpdater, NS_ERROR_FAILURE); * commandUpdater->CommandStatusChanged(obs_documentCreated); * diff --git a/editor/libeditor/HTMLTableEditor.cpp b/editor/libeditor/HTMLTableEditor.cpp index 57af21416c28..39ff5645d888 100644 --- a/editor/libeditor/HTMLTableEditor.cpp +++ b/editor/libeditor/HTMLTableEditor.cpp @@ -78,7 +78,7 @@ public: } // This is needed to abort the caret reset in the destructor - // when one method yields control to another + // when one method yields control to another void CancelSetCaret() { mHTMLEditor = nullptr; @@ -1835,7 +1835,7 @@ HTMLEditor::SelectBlockOfCells(Element* aStartCell, } // We can only select a block if within the same table, - // so do nothing if not within one table + // so do nothing if not within one table if (table != endTable) { return NS_OK; } @@ -1851,11 +1851,11 @@ HTMLEditor::SelectBlockOfCells(Element* aStartCell, } // Suppress nsISelectionListener notification - // until all selection changes are finished + // until all selection changes are finished SelectionBatcher selectionBatcher(SelectionRefPtr()); // Examine all cell nodes in current selection and - // remove those outside the new block cell region + // remove those outside the new block cell region int32_t minColumn = std::min(startCellIndexes.mColumn, endCellIndexes.mColumn); int32_t minRow = @@ -1958,7 +1958,7 @@ HTMLEditor::SelectAllTableCells() } // Suppress nsISelectionListener notification - // until all selection changes are finished + // until all selection changes are finished SelectionBatcher selectionBatcher(SelectionRefPtr()); // It is now safe to clear the selection @@ -2040,12 +2040,12 @@ HTMLEditor::SelectTableRow() return error.StealNSResult(); } - //Note: At this point, we could get first and last cells in row, - // then call SelectBlockOfCells, but that would take just - // a little less code, so the following is more efficient + // Note: At this point, we could get first and last cells in row, + // then call SelectBlockOfCells, but that would take just + // a little less code, so the following is more efficient // Suppress nsISelectionListener notification - // until all selection changes are finished + // until all selection changes are finished SelectionBatcher selectionBatcher(SelectionRefPtr()); // It is now safe to clear the selection @@ -2125,7 +2125,7 @@ HTMLEditor::SelectTableColumn() } // Suppress nsISelectionListener notification - // until all selection changes are finished + // until all selection changes are finished SelectionBatcher selectionBatcher(SelectionRefPtr()); // It is now safe to clear the selection @@ -2217,7 +2217,7 @@ HTMLEditor::SplitTableCell() int32_t rowSpanBelow, colSpanAfter; // Split up cell row-wise first into rowspan=1 above, and the rest below, - // whittling away at the cell below until no more extra span + // whittling away at the cell below until no more extra span for (rowSpanBelow = actualRowSpan-1; rowSpanBelow >= 0; rowSpanBelow--) { // We really split row-wise only if we had rowspan > 1 if (rowSpanBelow > 0) { @@ -2298,7 +2298,7 @@ HTMLEditor::SplitCellIntoColumns(Element* aTable, } // Insert new cell after using the remaining span - // and always get the new cell so we can copy the background color; + // and always get the new cell so we can copy the background color; RefPtr newCellElement; rv = InsertCell(cellData.mElement, cellData.mEffectiveRowSpan, aColSpanRight, true, false, @@ -2394,8 +2394,8 @@ HTMLEditor::SplitCellIntoRows(Element* aTable, break; } // If cell found is AFTER desired new cell colum, - // we have multiple cells with rowspan > 1 that - // prevented us from finding a cell to insert after... + // we have multiple cells with rowspan > 1 that + // prevented us from finding a cell to insert after... if (cellDataAtInsertionPoint.mFirst.mColumn > cellData.mFirst.mColumn) { // ... so instead insert before the cell we found insertAfter = false; @@ -2410,9 +2410,9 @@ HTMLEditor::SplitCellIntoRows(Element* aTable, if (!cellElementAtInsertionPoint && lastCellFound) { // Edge case where we didn't find a cell to insert after - // or before because column(s) before desired column - // and all columns after it are spanned from above. - // We can insert after the last cell we found + // or before because column(s) before desired column + // and all columns after it are spanned from above. + // We can insert after the last cell we found cellElementAtInsertionPoint = std::move(lastCellFound); insertAfter = true; // Should always be true, but let's be sure } @@ -2424,7 +2424,7 @@ HTMLEditor::SplitCellIntoRows(Element* aTable, } // Insert new cell after using the remaining span - // and always get the new cell so we can copy the background color; + // and always get the new cell so we can copy the background color; RefPtr newCell; rv = InsertCell(cellElementAtInsertionPoint, aRowSpanBelow, cellData.mEffectiveColSpan, @@ -2522,8 +2522,8 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents) AutoTransactionsConserveSelection dontChangeSelection(*this); // Note: We dont' use AutoSelectionSetterAfterTableEdit here so the selection - // is retained after joining. This leaves the target cell selected - // as well as the "non-contiguous" cells, so user can see what happened. + // is retained after joining. This leaves the target cell selected + // as well as the "non-contiguous" cells, so user can see what happened. ErrorResult error; CellAndIndexes firstSelectedCell(*this, *SelectionRefPtr(), error); @@ -2544,7 +2544,7 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents) if (joinSelectedCells) { // We have selected cells: Join just contiguous cells - // and just merge contents if not contiguous + // and just merge contents if not contiguous TableSize tableSize(*this, *table, error); if (NS_WARN_IF(error.Failed())) { return error.StealNSResult(); @@ -2561,10 +2561,10 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents) } // This defines the last indexes along the "edges" - // of the contiguous block of cells, telling us - // that we can join adjacent cells to the block + // of the contiguous block of cells, telling us + // that we can join adjacent cells to the block // Start with same as the first values, - // then expand as we find adjacent selected cells + // then expand as we find adjacent selected cells int32_t lastRowIndex = firstSelectedCell.mIndexes.mRow; int32_t lastColIndex = firstSelectedCell.mIndexes.mColumn; @@ -2621,7 +2621,7 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents) if (cellData.mCurrent.mRow > firstSelectedCell.mIndexes.mRow + 1 && cellData.mCurrent.mColumn <= lastColIndex) { // Cell is in a column less than current right border in - // the third or higher selected row, so stop block at the previous row + // the third or higher selected row, so stop block at the previous row lastRowIndex = std::max(0, cellData.mCurrent.mRow - 1); lastRowIsSet = true; } @@ -2643,7 +2643,7 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents) if (colIndex < lastColIndex) { // (don't think we ever get here?) // Cell is in a column less than current right boundary, - // so stop block at the previous row + // so stop block at the previous row lastRowIndex = std::max(0, rowIndex - 1); } else { // Go on to examine next row @@ -2654,7 +2654,7 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents) lastColIndex = std::min(lastColIndex, lastColInRow); } else { // No selected cells in this row -- stop at row above - // and leave last column at its previous value + // and leave last column at its previous value lastRowIndex = std::max(0, rowIndex - 1); } } @@ -2687,14 +2687,14 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents) cellData.mCurrent.mColumn <= lastColIndex) { // We are within the join region // Problem: It is very tricky to delete cells as we merge, - // since that will upset the cellmap - // Instead, build a list of cells to delete and do it later + // since that will upset the cellmap + // Instead, build a list of cells to delete and do it later NS_ASSERTION(!cellData.IsSpannedFromOtherRow(), "JoinTableCells: StartRowIndex is in row above"); if (cellData.mEffectiveColSpan > 1) { - //Check if cell "hangs" off the boundary because of colspan > 1 - // Use split methods to chop off excess + // Check if cell "hangs" off the boundary because of colspan > 1 + // Use split methods to chop off excess int32_t extraColSpan = cellData.mFirst.mColumn + cellData.mEffectiveColSpan - (lastColIndex + 1); @@ -2844,7 +2844,7 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents) // Merged cell is "shorter" // (there are cells(s) below it that are row-spanned by target cell) // We could try splitting those cells, but that's REAL messy, - // so the safest thing to do is NOT really join the cells + // so the safest thing to do is NOT really join the cells return NS_OK; } @@ -2884,7 +2884,7 @@ HTMLEditor::MergeCells(RefPtr aTargetCell, if (!IsEmptyCell(aCellToMerge)) { // Get index of last child in target cell // If we fail or don't have children, - // we insert at index 0 + // we insert at index 0 int32_t insertIndex = 0; // Start inserting just after last child @@ -3984,7 +3984,7 @@ HTMLEditor::SetSelectionAfterTableEdit(Element* aTable, // Set the caret to deepest first child // but don't go into nested tables // TODO: Should we really be placing the caret at the END - // of the cell content? + // of the cell content? CollapseSelectionToDeepestNonTableFirstChild(cell); return; } diff --git a/editor/spellchecker/TextServicesDocument.cpp b/editor/spellchecker/TextServicesDocument.cpp index 03821759cb47..97aba5f3a35c 100644 --- a/editor/spellchecker/TextServicesDocument.cpp +++ b/editor/spellchecker/TextServicesDocument.cpp @@ -845,7 +845,8 @@ TextServicesDocument::SetSelection(int32_t aOffset, nsresult rv = SetSelectionInternal(aOffset, aLength, true); //**** KDEBUG **** - // printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, + // mSelStartOffset, mSelEndIndex, mSelEndOffset); //**** KDEBUG **** return rv; @@ -1110,7 +1111,8 @@ TextServicesDocument::DeleteSelection() //**** KDEBUG **** // printf("\n---- After Delete\n"); - // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, + // mSelStartOffset, mSelEndIndex, mSelEndOffset); // PrintOffsetTable(); //**** KDEBUG **** @@ -1274,7 +1276,8 @@ TextServicesDocument::InsertText(const nsString* aText) //**** KDEBUG **** // printf("\n---- After Insert\n"); - // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, + // mSelStartOffset, mSelEndIndex, mSelEndOffset); // PrintOffsetTable(); //**** KDEBUG **** @@ -1690,6 +1693,7 @@ TextServicesDocument::IsBlockNode(nsIContent* aContent) nsAtom *atom = aContent->NodeInfo()->NameAtom(); + // clang-format off return (nsGkAtoms::a != atom && nsGkAtoms::address != atom && nsGkAtoms::big != atom && @@ -1716,6 +1720,7 @@ TextServicesDocument::IsBlockNode(nsIContent* aContent) nsGkAtoms::u != atom && nsGkAtoms::var != atom && nsGkAtoms::wbr != atom); + // clang-format on } // static @@ -1836,7 +1841,8 @@ TextServicesDocument::SetSelectionInternal(int32_t aOffset, mSelEndOffset = mSelStartOffset; //**** KDEBUG **** - // printf("\n* Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // printf("\n* Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, + // mSelStartOffset, mSelEndIndex, mSelEndOffset); //**** KDEBUG **** return NS_OK; @@ -1878,7 +1884,8 @@ TextServicesDocument::SetSelectionInternal(int32_t aOffset, } //**** KDEBUG **** - // printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, + // mSelStartOffset, mSelEndIndex, mSelEndOffset); //**** KDEBUG **** return NS_OK; diff --git a/extensions/cookie/nsPermissionManager.cpp b/extensions/cookie/nsPermissionManager.cpp index 5940a5344255..3e9c5caff937 100644 --- a/extensions/cookie/nsPermissionManager.cpp +++ b/extensions/cookie/nsPermissionManager.cpp @@ -103,10 +103,10 @@ static int32_t sPreloadPermissionCount = 0; // Permissions which are in this list are considered to have a "" permission // key, even if their principal would not normally have that key. static const char* kPreloadPermissions[] = { - // NOTE: These permissions are the different nsContentBlocker permissions for - // allowing or denying certain content types from being loaded. Every - // permission listed in the `kTypeString` array in nsContentBlocker.cpp should - // appear in this list. + // NOTE: These permissions are the different nsContentBlocker permissions + // for allowing or denying certain content types from being loaded. Every + // permission listed in the `kTypeString` array in nsContentBlocker.cpp + // should appear in this list. "other", "script", "image", diff --git a/extensions/spellcheck/src/mozPersonalDictionary.cpp b/extensions/spellcheck/src/mozPersonalDictionary.cpp index e66fc3aad56e..9ec7fd7d0b43 100644 --- a/extensions/spellcheck/src/mozPersonalDictionary.cpp +++ b/extensions/spellcheck/src/mozPersonalDictionary.cpp @@ -32,7 +32,7 @@ /** * This is the most braindead implementation of a personal dictionary possible. * There is not much complexity needed, though. It could be made much faster, - * and probably should, but I don't see much need for more in terms of interface. + * and probably should, but I don't see much need for more in terms of interface. * * Allowing personal words to be associated with only certain dictionaries maybe. * diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h index b568c2ccbeb8..11704fb6b4ed 100644 --- a/gfx/2d/2D.h +++ b/gfx/2d/2D.h @@ -349,7 +349,8 @@ public: Matrix mMatrix; //!< Transforms the pattern into user space IntRect mSamplingRect; /**< Rect that must not be sampled outside of, - or an empty rect if none has been specified. */ + or an empty rect if none has been + specified. */ }; class StoredPattern; @@ -956,7 +957,8 @@ public: * Creates a UnscaledFont using the font corresponding to the index. * * @param aIndex index for the font within the resource. - * @param aInstanceData pointer to read-only buffer of any available instance data. + * @param aInstanceData pointer to read-only buffer of any available instance + * data. * @param aInstanceDataLength the size of the instance data. * @return an already_addrefed UnscaledFont, containing nullptr if failed. */ @@ -1040,8 +1042,10 @@ public: * applying scaling. No sampling happens outside the source. * * @param aSurface Source surface to draw - * @param aDest Destination rectangle that this drawing operation should draw to - * @param aSource Source rectangle in aSurface coordinates, this area of aSurface + * @param aDest Destination rectangle that this drawing operation should draw + * to + * @param aSource Source rectangle in aSurface coordinates, this area of + * aSurface * will be stretched to the size of aDest. * @param aOptions General draw options that are applied to the operation * @param aSurfOptions DrawSurface options that are applied @@ -1466,7 +1470,8 @@ public: * filters. * * aScaledFont The scaled font used when drawing. - * aGlyphIndices An array of indices for the glyphs whose the metrics are wanted + * aGlyphIndices An array of indices for the glyphs whose the metrics are + * wanted * aNumGlyphs The amount of elements in aGlyphIndices * aGlyphMetrics The glyph metrics */ @@ -1724,9 +1729,11 @@ public: * * @param aData Pointer to the data * @param aSize Size of the TrueType data - * @param aBackendType Type of the reference DrawTarget the font should be created for. + * @param aBackendType Type of the reference DrawTarget the font should be + * created for. * @param aFontType Type of NativeFontResource that should be created. - * @param aFontContext Optional native font context to be used to create the NativeFontResource. + * @param aFontContext Optional native font context to be used to create the + * NativeFontResource. * @return a NativeFontResource of nullptr if failed. */ static already_AddRefed diff --git a/gfx/2d/Blur.cpp b/gfx/2d/Blur.cpp index 9866faaa65a3..9e9e6f604ba1 100644 --- a/gfx/2d/Blur.cpp +++ b/gfx/2d/Blur.cpp @@ -214,9 +214,11 @@ BoxBlurRow(const uint8_t* aInput, * Box blur involves looking at one pixel, and setting its value to the average * of its neighbouring pixels. This is meant to provide a 3-pass approximation of a * Gaussian blur. - * @param aTranspose Whether to transpose the buffer when reading and writing to it. + * @param aTranspose Whether to transpose the buffer when reading and writing + * to it. * @param aData The buffer to be blurred. - * @param aLobes The number of pixels to blend on the left and right for each of 3 passes. + * @param aLobes The number of pixels to blend on the left and right for each of + * 3 passes. * @param aWidth The number of columns in the buffers. * @param aRows The number of rows in the buffers. * @param aStride The stride of the buffer. diff --git a/gfx/2d/DrawTargetSkia.cpp b/gfx/2d/DrawTargetSkia.cpp index 7fdc27463259..a24899543832 100644 --- a/gfx/2d/DrawTargetSkia.cpp +++ b/gfx/2d/DrawTargetSkia.cpp @@ -1055,7 +1055,8 @@ GfxMatrixToCGAffineTransform(const Matrix &m) * We cannot cancel out (2) and (3) as we have to apply the clips and transforms * of DrawTargetSkia between (2) and (3). * - * Consider the example letter P, drawn at (0, 20) in CG coordinates in a (100, 100) rect. + * Consider the example letter P, drawn at (0, 20) in CG coordinates in a + * (100, 100) rect. * Again, going right to left of the transforms. We'd get: * * 1) The letter P drawn at (0, -20) due to the inversion of the Y axis diff --git a/gfx/2d/DrawTargetWrapAndRecord.h b/gfx/2d/DrawTargetWrapAndRecord.h index c75f1a51848e..c734662450ac 100644 --- a/gfx/2d/DrawTargetWrapAndRecord.h +++ b/gfx/2d/DrawTargetWrapAndRecord.h @@ -320,7 +320,8 @@ private: * We have to call CreateSimilarDrawTarget on mFinalDT up front and pass it in * as it can fail. * - * @param aDT DrawTargetWrapAndRecord on which CreateSimilarDrawTarget was called + * @param aDT DrawTargetWrapAndRecord on which CreateSimilarDrawTarget was + * called * @param aSimilarDT Similar DrawTarget created from aDT.mFinalDT. */ DrawTargetWrapAndRecord(const DrawTargetWrapAndRecord *aDT, diff --git a/gfx/2d/FilterProcessingSIMD-inl.h b/gfx/2d/FilterProcessingSIMD-inl.h index c17d047cac52..4dd8db35078c 100644 --- a/gfx/2d/FilterProcessingSIMD-inl.h +++ b/gfx/2d/FilterProcessingSIMD-inl.h @@ -247,12 +247,14 @@ template inline i32x4_t BlendAlphaOfFourPixels(i16x8_t s_rrrraaaa1234, i16x8_t d_rrrraaaa1234) { + // clang-format off // We're using MulAdd16x8x2To32x4, so we need to interleave our factors // appropriately. The calculation is rewritten as follows: // resultAlpha[0] * 255 = 255 * 255 - (255 - sourceAlpha[0]) * (255 - destAlpha[0]) // = 255 * 255 + (255 - sourceAlpha[0]) * (destAlpha[0] - 255) // = (255 - 0) * (510 - 255) + (255 - sourceAlpha[0]) * (destAlpha[0] - 255) // = MulAdd(255 - IntLv(0, sourceAlpha), IntLv(510, destAlpha) - 255)[0] + // clang-format on i16x8_t zeroInterleavedWithSourceAlpha = simd::InterleaveHi16(simd::FromI16(0), s_rrrraaaa1234); i16x8_t fiveTenInterleavedWithDestAlpha = simd::InterleaveHi16(simd::FromI16(510), d_rrrraaaa1234); i16x8_t f1 = simd::Sub16(simd::FromI16(255), zeroInterleavedWithSourceAlpha); @@ -517,13 +519,15 @@ ColorMatrixMultiply(i16x8_t p, i16x8_t rows_bg, i16x8_t rows_ra, const i32x4_t& // int16_t bg[8] = { b, g, b, g, b, g, b, g }; i16x8_t bg = simd::ShuffleHi16<1,0,1,0>(simd::ShuffleLo16<1,0,1,0>(p)); - // int32_t prodsum_bg[4] = { b * bB + g * gB, b * bG + g * gG, b * bR + g * gR, b * bA + g * gA } + // int32_t prodsum_bg[4] = + // { b * bB + g * gB, b * bG + g * gG, b * bR + g * gR, b * bA + g * gA } i32x4_t prodsum_bg = simd::MulAdd16x8x2To32x4(bg, rows_bg); sum = simd::Add32(sum, prodsum_bg); // uint16_t ra[8] = { r, a, r, a, r, a, r, a }; i16x8_t ra = simd::ShuffleHi16<3,2,3,2>(simd::ShuffleLo16<3,2,3,2>(p)); - // int32_t prodsum_ra[4] = { r * rB + a * aB, r * rG + a * aG, r * rR + a * aR, r * rA + a * aA } + // int32_t prodsum_ra[4] = + // { r * rB + a * aB, r * rG + a * aG, r * rR + a * aR, r * rA + a * aA } i32x4_t prodsum_ra = simd::MulAdd16x8x2To32x4(ra, rows_ra); sum = simd::Add32(sum, prodsum_ra); diff --git a/gfx/2d/HelpersD2D.h b/gfx/2d/HelpersD2D.h index 04237f04340b..fe64166ece1b 100644 --- a/gfx/2d/HelpersD2D.h +++ b/gfx/2d/HelpersD2D.h @@ -583,6 +583,7 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin // Limit the uploadRect as much as possible without supporting discontiguous uploads // + // clang-format off // region we will paint from // uploadRect // .---------------. .---------------. resulting uploadRect @@ -591,6 +592,7 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin // | | | ----> | | | | ----> | | // | '---------' '----' '----' '---------------' // '---------------' '---------------' + // clang-format on // // diff --git a/gfx/2d/JobScheduler_posix.cpp b/gfx/2d/JobScheduler_posix.cpp index 78c583f9c557..90323a2eaa6f 100644 --- a/gfx/2d/JobScheduler_posix.cpp +++ b/gfx/2d/JobScheduler_posix.cpp @@ -32,15 +32,18 @@ public: // XXX - temporarily disabled, see bug 1209039 // // // Call this from the thread itself because of Mac. -//#ifdef XP_MACOSX -// pthread_setname_np(aName); -//#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) -// pthread_set_name_np(mThread, aName); -//#elif defined(__NetBSD__) -// pthread_setname_np(mThread, "%s", (void*)aName); -//#else -// pthread_setname_np(mThread, aName); -//#endif +/* +#ifdef XP_MACOSX + pthread_setname_np(aName); +#elif defined(__DragonFly__) || defined(__FreeBSD__) || \ + defined(__OpenBSD__) + pthread_set_name_np(mThread, aName); +#elif defined(__NetBSD__) + pthread_setname_np(mThread, "%s", (void*)aName); +#else + pthread_setname_np(mThread, aName); +#endif +*/ } protected: diff --git a/gfx/2d/Logging.h b/gfx/2d/Logging.h index d2d23eb12dd5..98dcb1499e6a 100644 --- a/gfx/2d/Logging.h +++ b/gfx/2d/Logging.h @@ -758,7 +758,8 @@ typedef Log CriticalLog; // This is a shortcut for errors we want logged in crash reports/about support // but we do not want asserting. These are available in all builds, so it is -// not worth trying to do magic to avoid matching the syntax of gfxCriticalError. +// not worth trying to do magic to avoid matching the syntax of +// gfxCriticalError. // So, this one is used as // gfxCriticalNote << "Something to report and not assert"; // while the critical error is diff --git a/gfx/2d/Path.cpp b/gfx/2d/Path.cpp index 4b912f8c140a..8fab62463358 100644 --- a/gfx/2d/Path.cpp +++ b/gfx/2d/Path.cpp @@ -340,14 +340,17 @@ FindInflectionApproximationRange(BezierControlPoints aControlPoints, * curve is degenerate in such a way that it is best approximated by a straight * line. * - * The below algorithm was written by Jeff Muizelaar , explanation follows: + * The below algorithm was written by Jeff Muizelaar , + * explanation follows: * * The lower inflection point is returned in aT1, the higher one in aT2. In the * case of a single inflection point this will be in aT1. * - * The method is inspired by the algorithm in "analysis of in?ection points for planar cubic bezier curve" + * The method is inspired by the algorithm in "analysis of in?ection points for + * planar cubic bezier curve" * - * Here are some differences between this algorithm and versions discussed elsewhere in the literature: + * Here are some differences between this algorithm and versions discussed + * elsewhere in the literature: * * zhang et. al compute a0, d0 and e0 incrementally using the follow formula: * @@ -360,9 +363,11 @@ FindInflectionApproximationRange(BezierControlPoints aControlPoints, * Point e0 = d1 - d0 * - * this avoids any multiplications and may or may not be faster than the approach take below. + * this avoids any multiplications and may or may not be faster than the + * approach take below. * - * "fast, precise flattening of cubic bezier path and ofset curves" by hain et. al + * "fast, precise flattening of cubic bezier path and ofset curves" by hain et. + * al * Point a = CP1 + 3 * CP2 - 3 * CP3 + CP4 * Point b = 3 * CP1 - 6 * CP2 + 3 * CP3 * Point c = -3 * CP1 + 3 * CP2 diff --git a/gfx/2d/Swizzle.cpp b/gfx/2d/Swizzle.cpp index 99cc85037e11..d69410cc8481 100644 --- a/gfx/2d/Swizzle.cpp +++ b/gfx/2d/Swizzle.cpp @@ -209,10 +209,11 @@ PremultiplyFallback(const uint8_t* aSrc, int32_t aSrcGap, if (aSwapRB) { rb = (rb >> 16) | (rb << 16); } - // Approximate the multiply by alpha and divide by 255 which is essentially: + // Approximate the multiply by alpha and divide by 255 which is + // essentially: // c = c*a + 255; c = (c + (c >> 8)) >> 8; - // However, we omit the final >> 8 to fold it with the final shift into place - // depending on desired output format. + // However, we omit the final >> 8 to fold it with the final shift into + // place depending on desired output format. rb = rb*a + 0x00FF00FF; rb = (rb + ((rb >> 8) & 0x00FF00FF)) & 0xFF00FF00; diff --git a/gfx/2d/SwizzleNEON.cpp b/gfx/2d/SwizzleNEON.cpp index 487577e89b0c..e4f4040765e1 100644 --- a/gfx/2d/SwizzleNEON.cpp +++ b/gfx/2d/SwizzleNEON.cpp @@ -184,14 +184,15 @@ UnpremultiplyVector_NEON(const uint16x8_t& aSrc) // lo1 lo1 lo2 lo2 lo3 lo3 lo4 lo4 and hi1 hi1 hi2 hi2 hi3 hi3 hi4 hi4 uint16x8x2_t q1234lohi = vtrnq_u16(q1234, q1234); - // VQDMULH is a signed multiply that doubles (*2) the result, then takes the high word. - // To work around the signedness and the doubling, the low portion of the reciprocal only - // stores the lower 15 bits, which fits in a signed 16 bit integer. The high 9 bit portion - // is effectively also doubled by 2 as a side-effect of being shifted for storage. Thus the - // output scale of doing a normal multiply by the high portion and the VQDMULH by the low - // portion are both doubled and can be safely added together. The resulting sum just needs - // to be halved (via VHADD) to thus cancel out the doubling. All this combines to produce - // a reciprocal multiply of the form: + // VQDMULH is a signed multiply that doubles (*2) the result, then takes the + // high word. To work around the signedness and the doubling, the low + // portion of the reciprocal only stores the lower 15 bits, which fits in a + // signed 16 bit integer. The high 9 bit portion is effectively also doubled + // by 2 as a side-effect of being shifted for storage. Thus the output scale + // of doing a normal multiply by the high portion and the VQDMULH by the low + // portion are both doubled and can be safely added together. The resulting + // sum just needs to be halved (via VHADD) to thus cancel out the doubling. + // All this combines to produce a reciprocal multiply of the form: // rb = ((rb * hi) + ((rb * lo * 2) >> 16)) / 2 rb = vhaddq_u16( diff --git a/gfx/gl/ForceDiscreteGPUHelperCGL.h b/gfx/gl/ForceDiscreteGPUHelperCGL.h index 9ede68e9daa1..4f4914b95fa5 100644 --- a/gfx/gl/ForceDiscreteGPUHelperCGL.h +++ b/gfx/gl/ForceDiscreteGPUHelperCGL.h @@ -20,7 +20,8 @@ public: ForceDiscreteGPUHelperCGL() : mPixelFormatObj(nullptr) { - // the code in this function is taken from Chromium, src/ui/gfx/gl/gl_context_cgl.cc, r122013 + // the code in this function is taken from Chromium, + // src/ui/gfx/gl/gl_context_cgl.cc, r122013 // BSD-style license, (c) The Chromium Authors CGLPixelFormatAttribute attribs[1]; attribs[0] = static_cast(0); diff --git a/gfx/gl/GLContextProviderWGL.cpp b/gfx/gl/GLContextProviderWGL.cpp index d20ff7384b93..03dbe0188dc1 100644 --- a/gfx/gl/GLContextProviderWGL.cpp +++ b/gfx/gl/GLContextProviderWGL.cpp @@ -176,6 +176,7 @@ WGLLibrary::EnsureInitialized() // Now we can grab all the other symbols that we couldn't without having // a context current. + // clang-format off const GLLibraryLoader::SymLoadStruct reqExtSymbols[] = { { (PRFuncPtr*)&mSymbols.fCreatePbuffer, { "wglCreatePbufferARB", "wglCreatePbufferEXT", nullptr } }, { (PRFuncPtr*)&mSymbols.fDestroyPbuffer, { "wglDestroyPbufferARB", "wglDestroyPbufferEXT", nullptr } }, @@ -188,6 +189,7 @@ WGLLibrary::EnsureInitialized() SYMBOL(GetExtensionsStringARB), END_OF_SYMBOLS }; + // clang-format on if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, reqExtSymbols, lookupFunc)) { NS_WARNING("reqExtSymbols missing"); return false;