зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1508472 - Part 2: Second batch of comment fix-ups in preparation for the tree reformat r=sylvestre
This is a best effort attempt at ensuring that the adverse impact of reformatting the entire tree over the comments would be minimal. I've used a combination of strategies including disabling of formatting, some manual formatting and some changes to formatting to work around some clang-format limitations. Differential Revision: https://phabricator.services.mozilla.com/D13073 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
8afcdbd07c
Коммит
2febd96e7e
|
@ -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.
|
||||
*/
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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' \ \
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -42,10 +42,12 @@ class HRTFDatabase {
|
|||
public:
|
||||
static nsReturnRef<HRTFDatabase> 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.
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<ID_HookedFunc,
|
||||
* int HOOK_CALL (nsDependentCSubstring)> 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<>
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -29,7 +29,8 @@ class WorkerPrivate;
|
|||
// 1. Create a Promise on the worker thread and return it to the content
|
||||
// script:
|
||||
//
|
||||
// RefPtr<Promise> promise = Promise::Create(workerPrivate->GlobalScope(), aRv);
|
||||
// RefPtr<Promise> promise =
|
||||
// Promise::Create(workerPrivate->GlobalScope(), aRv);
|
||||
// if (aRv.Failed()) {
|
||||
// return nullptr;
|
||||
// }
|
||||
|
@ -79,7 +80,8 @@ class WorkerPrivate;
|
|||
// worker.
|
||||
//
|
||||
// RefPtr<FinishTaskWorkerRunnable> 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
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<nsIPrincipal> principal;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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<uint16_t>& aCode,
|
||||
const Optional<nsAString>& aReason,
|
||||
ErrorResult& aRv);
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<nsICommandManager> commandManager = mDocShell->GetCommandManager();
|
||||
* nsCOMPtr<nsPICommandUpdater> commandUpdater = do_QueryInterface(commandManager);
|
||||
* nsCOMPtr<nsPICommandUpdater> commandUpdater =
|
||||
* do_QueryInterface(commandManager);
|
||||
* NS_ENSURE_TRUE(commandUpdater, NS_ERROR_FAILURE);
|
||||
* commandUpdater->CommandStatusChanged(obs_documentCreated);
|
||||
*
|
||||
|
|
|
@ -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<Element> 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<Element> 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<Element> 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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
21
gfx/2d/2D.h
21
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<NativeFontResource>
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -247,12 +247,14 @@ template<typename i16x8_t, typename i32x4_t>
|
|||
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<i16x8_t>(0), s_rrrraaaa1234);
|
||||
i16x8_t fiveTenInterleavedWithDestAlpha = simd::InterleaveHi16(simd::FromI16<i16x8_t>(510), d_rrrraaaa1234);
|
||||
i16x8_t f1 = simd::Sub16(simd::FromI16<i16x8_t>(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);
|
||||
|
||||
|
|
|
@ -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
|
||||
//
|
||||
//
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -758,7 +758,8 @@ typedef Log<LOG_CRITICAL, CriticalLogger> 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
|
||||
|
|
|
@ -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 <jmuizelaar@mozilla.com>, explanation follows:
|
||||
* The below algorithm was written by Jeff Muizelaar <jmuizelaar@mozilla.com>,
|
||||
* 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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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<CGLPixelFormatAttribute>(0);
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче