commit 637cccbe8def959a1b1d1a2398c80939fae1d8c4 parent 926bbd302aee0649d9d55b872169c218727f8669 Author: Sylvestre Ledru <sylvestre@debian.org> Date: Tue, 30 Sep 2025 11:52:33 +0000 Bug 1519636 - Reformat recent changes to the Google coding style r=emilio Generated with clang-format version 19.1.7 (taskcluster-ImeD-jyDRx-_6soViZ_luw) # ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D266586 Diffstat:
19 files changed, 301 insertions(+), 277 deletions(-)
diff --git a/dom/gamepad/GamepadPoseState.h b/dom/gamepad/GamepadPoseState.h @@ -9,6 +9,7 @@ #include <cstdint> #include <cstring> + #include "mozilla/TypedEnumBits.h" namespace mozilla::dom { diff --git a/dom/media/UnboundedMPSCQueue.h b/dom/media/UnboundedMPSCQueue.h @@ -31,8 +31,8 @@ class UnboundedMPSCQueue { T data; }; - // Creates a new UnboundedMPSCQueue. Initially, the queue has a single sentinel node, - // pointed to by both mHead and mTail. + // Creates a new UnboundedMPSCQueue. Initially, the queue has a single + // sentinel node, pointed to by both mHead and mTail. UnboundedMPSCQueue() // At construction, the initial message points to nullptr (it has no // successor). It is a sentinel node, that does not contain meaningful diff --git a/dom/media/systemservices/android_video_capture/device_info_android.cc b/dom/media/systemservices/android_video_capture/device_info_android.cc @@ -11,14 +11,13 @@ #include "device_info_android.h" #include <algorithm> -#include <string> #include <sstream> +#include <string> #include <vector> -#include "rtc_base/logging.h" #include "modules/utility/include/helpers_android.h" - #include "mozilla/jni/Utils.h" +#include "rtc_base/logging.h" namespace webrtc { diff --git a/dom/media/systemservices/android_video_capture/video_capture_android.cc b/dom/media/systemservices/android_video_capture/video_capture_android.cc @@ -10,14 +10,13 @@ #include "video_capture_android.h" +#include "AndroidBridge.h" #include "device_info_android.h" #include "modules/utility/include/helpers_android.h" #include "rtc_base/logging.h" #include "rtc_base/ref_counted_object.h" #include "rtc_base/time_utils.h" -#include "AndroidBridge.h" - static JavaVM* g_jvm_capture = NULL; static jclass g_java_capturer_class = NULL; // VideoCaptureAndroid.class. static jobject g_context = NULL; // Owned android.content.Context. diff --git a/dom/media/systemservices/fake_video_capture/device_info_fake.cc b/dom/media/systemservices/fake_video_capture/device_info_fake.cc @@ -5,6 +5,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "device_info_fake.h" + #include <string.h> namespace webrtc::videocapturemodule { diff --git a/dom/media/systemservices/video_engine/placeholder_device_info.cc b/dom/media/systemservices/video_engine/placeholder_device_info.cc @@ -5,6 +5,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "placeholder_device_info.h" + #include "modules/video_capture/video_capture_factory.h" namespace mozilla { diff --git a/dom/media/systemservices/video_engine/tab_capturer.cc b/dom/media/systemservices/video_engine/tab_capturer.cc @@ -14,14 +14,14 @@ #include "modules/desktop_capture/desktop_capture_options.h" #include "modules/desktop_capture/desktop_frame.h" #include "mozilla/Logging.h" +#include "mozilla/SpinEventLoopUntil.h" +#include "mozilla/TaskQueue.h" #include "mozilla/dom/BrowsingContext.h" #include "mozilla/dom/ImageBitmap.h" #include "mozilla/dom/Promise.h" #include "mozilla/dom/PromiseNativeHandler.h" #include "mozilla/dom/WindowGlobalParent.h" #include "mozilla/gfx/2D.h" -#include "mozilla/SpinEventLoopUntil.h" -#include "mozilla/TaskQueue.h" #include "nsThreadUtils.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" diff --git a/dom/media/webrtc/transport/test/turn_unittest.cpp b/dom/media/webrtc/transport/test/turn_unittest.cpp @@ -40,6 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <stdlib.h> + #include <iostream> #include "runnable_utils.h" diff --git a/dom/webgpu/tests/cts/checkout/tools/af_data_gen/main.cpp b/dom/webgpu/tests/cts/checkout/tools/af_data_gen/main.cpp @@ -14,12 +14,12 @@ * instead is a reference for how the values in af_data.ts were generated */ #include <cassert> -#include <cstdint> -#include <iostream> #include <cfenv> +#include <cmath> +#include <cstdint> #include <format> #include <iomanip> -#include <cmath> +#include <iostream> #include <map> #include <memory> #include <set> @@ -31,10 +31,14 @@ /** Magic constants that should match the entries in constants.ts's kBit.f64 */ constexpr double kF64NegativeMin = std::bit_cast<double>(0xFFEFFFFFFFFFFFFFull); constexpr double kF64NegativeMax = std::bit_cast<double>(0x8010000000000000ull); -constexpr double kF64NegativeSubnormalMin = std::bit_cast<double>(0x800FFFFFFFFFFFFFull); -constexpr double kF64NegativeSubnormalMax = std::bit_cast<double>(0x8000000000000001ull); -constexpr double kF64PositiveSubnormalMin = std::bit_cast<double>(0x0000000000000001ull); -constexpr double kF64PositiveSubnormalMax = std::bit_cast<double>(0x000FFFFFFFFFFFFFull); +constexpr double kF64NegativeSubnormalMin = + std::bit_cast<double>(0x800FFFFFFFFFFFFFull); +constexpr double kF64NegativeSubnormalMax = + std::bit_cast<double>(0x8000000000000001ull); +constexpr double kF64PositiveSubnormalMin = + std::bit_cast<double>(0x0000000000000001ull); +constexpr double kF64PositiveSubnormalMax = + std::bit_cast<double>(0x000FFFFFFFFFFFFFull); constexpr double kF64PositiveMin = std::bit_cast<double>(0x0010000000000000ull); constexpr double kF64PositiveMax = std::bit_cast<double>(0x7FEFFFFFFFFFFFFFull); @@ -43,34 +47,37 @@ constexpr double kF64PositiveMax = std::bit_cast<double>(0x7FEFFFFFFFFFFFFFull); * values that appear in kInterestingF64Values in math.ts */ const std::map<double, std::string> kInterestingF64s = { - { kF64NegativeMin, "kValue.f64.negative.min" }, - { -10.0, "-10.0" }, - { -1.0, "-1.0" }, - { -0.125, "-0.125" }, - { kF64NegativeMax, "kValue.f64.negative.max"}, - { kF64NegativeSubnormalMin, "kValue.f64.negative.subnormal.min" }, - { kF64NegativeSubnormalMax, "kValue.f64.negative.subnormal.max" }, - { 0.0, "0.0" }, - { kF64PositiveSubnormalMin, "kValue.f64.positive.subnormal.min" }, - { kF64PositiveSubnormalMax, "kValue.f64.positive.subnormal.max" }, - { kF64PositiveMin, "kValue.f64.positive.min" }, - { 0.125, "0.125" }, - { 1.0, "1.0" }, - { 10.0, "10.0" }, - { kF64PositiveMax, "kValue.f64.positive.max"} -}; + {kF64NegativeMin, "kValue.f64.negative.min"}, + {-10.0, "-10.0"}, + {-1.0, "-1.0"}, + {-0.125, "-0.125"}, + {kF64NegativeMax, "kValue.f64.negative.max"}, + {kF64NegativeSubnormalMin, "kValue.f64.negative.subnormal.min"}, + {kF64NegativeSubnormalMax, "kValue.f64.negative.subnormal.max"}, + {0.0, "0.0"}, + {kF64PositiveSubnormalMin, "kValue.f64.positive.subnormal.min"}, + {kF64PositiveSubnormalMax, "kValue.f64.positive.subnormal.max"}, + {kF64PositiveMin, "kValue.f64.positive.min"}, + {0.125, "0.125"}, + {1.0, "1.0"}, + {10.0, "10.0"}, + {kF64PositiveMax, "kValue.f64.positive.max"}}; /** Additional values to use for testing 'fract' */ const std::map<double, std::string> kFractF64s = { - { 0.5, "0.5" }, // 0.5 -> 0.5 - { 1, "1" }, // 1 -> 0 - { 2, "2" }, // 2 -> 0 - { -0.5, "-0.5" }, // -0.5 -> 0.5 - { -1, "-1" }, // -1 -> 0 - { -2, "-2" }, // -2 -> 0 - { 10.0000999999999997669, "10.0000999999999997669" }, // ~10.0001 -> ~0.0001 - { -10.0000999999999997669, "-10.0000999999999997669" }, // -10.0001 -> ~0.9999 - { 3937509.87755102012306, "3937509.87755102012306" }, // 3937509.87755102012306 -> ~0.877551..., not [0, 0.75], https://github.com/gpuweb/gpuweb/issues/4523 + {0.5, "0.5"}, // 0.5 -> 0.5 + {1, "1"}, // 1 -> 0 + {2, "2"}, // 2 -> 0 + {-0.5, "-0.5"}, // -0.5 -> 0.5 + {-1, "-1"}, // -1 -> 0 + {-2, "-2"}, // -2 -> 0 + {10.0000999999999997669, "10.0000999999999997669"}, // ~10.0001 -> ~0.0001 + {-10.0000999999999997669, + "-10.0000999999999997669"}, // -10.0001 -> ~0.9999 + {3937509.87755102012306, + "3937509.87755102012306"}, // 3937509.87755102012306 -> ~0.877551..., not + // [0, 0.75], + // https://github.com/gpuweb/gpuweb/issues/4523 }; /** @@ -78,33 +85,36 @@ const std::map<double, std::string> kFractF64s = { * a CTS test */ std::string printAbstractFloat(const double val) { - if (!std::isfinite(val)) { - if (val > 0) { - return "kValue.f64.positive.infinity"; - } - if (val < 0) { - return "kValue.f64.negative.infinity"; - } - assert("Generated a NaN"); + if (!std::isfinite(val)) { + if (val > 0) { + return "kValue.f64.positive.infinity"; } - - if (const auto iter = kInterestingF64s.find(val); iter != kInterestingF64s.end()) { - return iter->second; + if (val < 0) { + return "kValue.f64.negative.infinity"; } + assert("Generated a NaN"); + } - std::stringstream ss; - // Print 'easy' to read integers as literals, otherwise dump the hex value - if ( val == round(val) && fabs(val) < 100000) { - ss << val; - } else { - ss << "reinterpretU64AsF64(0x" << std::hex << std::setfill('0') << std::setw(16) << std::bit_cast<uint64_t>(val) << "n) /* " << val << " */"; - } - return ss.str(); + if (const auto iter = kInterestingF64s.find(val); + iter != kInterestingF64s.end()) { + return iter->second; + } + + std::stringstream ss; + // Print 'easy' to read integers as literals, otherwise dump the hex value + if (val == round(val) && fabs(val) < 100000) { + ss << val; + } else { + ss << "reinterpretU64AsF64(0x" << std::hex << std::setfill('0') + << std::setw(16) << std::bit_cast<uint64_t>(val) << "n) /* " << val + << " */"; + } + return ss.str(); } /** Could this value potentially be affected by FTZ behaviour */ bool couldBeFlushed(const double val) { - return std::fpclassify(val) == FP_SUBNORMAL; + return std::fpclassify(val) == FP_SUBNORMAL; } /** @@ -120,95 +130,98 @@ bool couldBeFlushed(const double val) { * processes. */ std::tuple<double, double> quantizeToAbstractFloat(const long double val) { - const int round_mode = fegetround(); + const int round_mode = fegetround(); - assert(0 == fesetround(FE_DOWNWARD)); - const auto downward = static_cast<double>(val); - assert(0 == fesetround(FE_UPWARD)); - const auto upward = static_cast<double>(val); + assert(0 == fesetround(FE_DOWNWARD)); + const auto downward = static_cast<double>(val); + assert(0 == fesetround(FE_UPWARD)); + const auto upward = static_cast<double>(val); - assert(0 == fesetround(round_mode)); + assert(0 == fesetround(round_mode)); - return { downward, upward }; + return {downward, upward}; } /** * Generates a string for an unary operation result that can be copied into a * CTS test file. */ -std::string printBinaryCase(const std::string &input, const std::vector<double> &result) { - assert(!result.empty()); - std::stringstream ss; - ss << "{ input: "; - ss << input; - ss << ", "; - ss << "expected: [ "; - if (!result.empty()) { - for (auto i = 0; i < result.size() - 1; i++) { - ss << "" << printAbstractFloat(result[i]) << ", "; - } - ss << printAbstractFloat(result.back()); +std::string printBinaryCase(const std::string& input, + const std::vector<double>& result) { + assert(!result.empty()); + std::stringstream ss; + ss << "{ input: "; + ss << input; + ss << ", "; + ss << "expected: [ "; + if (!result.empty()) { + for (auto i = 0; i < result.size() - 1; i++) { + ss << "" << printAbstractFloat(result[i]) << ", "; } - ss << " ] }"; - return ss.str(); + ss << printAbstractFloat(result.back()); + } + ss << " ] }"; + return ss.str(); } /** * Generates a string for a binary operation result that can be copied into a * CTS test file. */ -std::string printBinaryCase(const std::string &lhs, const std::string &rhs, const std::vector<double> &result) { - assert(!result.empty()); - std::stringstream ss; - ss << "{ lhs: "; - ss << lhs; - ss << ", rhs: "; - ss << rhs; - ss << ", "; - ss << "expected: [ "; - if (!result.empty()) { - for (auto i = 0; i < result.size() - 1; i++) { - ss << "" << printAbstractFloat(result[i]) << ", "; - } - ss << printAbstractFloat(result.back()); +std::string printBinaryCase(const std::string& lhs, const std::string& rhs, + const std::vector<double>& result) { + assert(!result.empty()); + std::stringstream ss; + ss << "{ lhs: "; + ss << lhs; + ss << ", rhs: "; + ss << rhs; + ss << ", "; + ss << "expected: [ "; + if (!result.empty()) { + for (auto i = 0; i < result.size() - 1; i++) { + ss << "" << printAbstractFloat(result[i]) << ", "; } - ss << " ] }"; - return ss.str(); + ss << printAbstractFloat(result.back()); + } + ss << " ] }"; + return ss.str(); } /** Function that performs a binary operation, i.e. addition, etc */ typedef long double (*BinaryOp)(long double, long double); -const BinaryOp kAdditionOp= [](const long double lhs, const long double rhs) { - return lhs + rhs; +const BinaryOp kAdditionOp = [](const long double lhs, const long double rhs) { + return lhs + rhs; }; -const BinaryOp kSubtractionOp= [](const long double lhs, const long double rhs) { - return lhs - rhs; -}; +const BinaryOp kSubtractionOp = [](const long double lhs, + const long double rhs) { return lhs - rhs; }; -const BinaryOp kMultiplicationOp= [](const long double lhs, const long double rhs) { - return lhs * rhs; -}; +const BinaryOp kMultiplicationOp = + [](const long double lhs, const long double rhs) { return lhs * rhs; }; /** * Calculates all of the possible results for a binary operation given the * provided inputs. This handles both quantization and flushing behaviours. */ -std::vector<double> calculateBinaryResults(const BinaryOp op, long double lhs, long double rhs) { - // CTS needs to consider that subnormals may be flushed to zero at - // any point, so applying potential flushings to get additional - // results. - std::set<double> results; - for (const auto l: couldBeFlushed(lhs) ? std::vector{0, lhs} : std::vector{lhs}) { - for (const auto r: couldBeFlushed(rhs) ? std::vector{0, rhs} : std::vector{rhs}) { - const auto [downward, upward] = quantizeToAbstractFloat(op(l, r)); - results.insert(downward); - results.insert(upward); - } +std::vector<double> calculateBinaryResults(const BinaryOp op, long double lhs, + long double rhs) { + // CTS needs to consider that subnormals may be flushed to zero at + // any point, so applying potential flushings to get additional + // results. + std::set<double> results; + for (const auto l : + couldBeFlushed(lhs) ? std::vector{0, lhs} : std::vector{lhs}) { + for (const auto r : + couldBeFlushed(rhs) ? std::vector{0, rhs} : std::vector{rhs}) { + const auto [downward, upward] = quantizeToAbstractFloat(op(l, r)); + results.insert(downward); + results.insert(upward); } + } - return { results.begin(), results.end() }; + return {results.begin(), results.end()}; } /** @@ -216,15 +229,17 @@ std::vector<double> calculateBinaryResults(const BinaryOp op, long double lhs, l * tests cases for a binary operation. */ std::string printBinaryOpCases(const BinaryOp op, const std::string& name) { - std::stringstream ss; - ss << "BEGIN " << name << " CASES" << std::endl; - for (const auto& [lhs, lhs_str] : kInterestingF64s) { - for (const auto& [rhs, rhs_str] : kInterestingF64s) { - ss << printBinaryCase(lhs_str, rhs_str, calculateBinaryResults(op, lhs, rhs)) << "," << std::endl; - } + std::stringstream ss; + ss << "BEGIN " << name << " CASES" << std::endl; + for (const auto& [lhs, lhs_str] : kInterestingF64s) { + for (const auto& [rhs, rhs_str] : kInterestingF64s) { + ss << printBinaryCase(lhs_str, rhs_str, + calculateBinaryResults(op, lhs, rhs)) + << "," << std::endl; } - ss << "END " << name << " CASES" << std::endl; - return ss.str(); + } + ss << "END " << name << " CASES" << std::endl; + return ss.str(); } /** @@ -232,39 +247,47 @@ std::string printBinaryOpCases(const BinaryOp op, const std::string& name) { * tests cases for `fract`. WGSL defines frac(x) = x - floor(x). */ std::string printFractCases() { - std::stringstream ss; - ss << "BEGIN FRACT CASES" << std::endl; - // Do not have to calculate quantization/roundings for floor(input), - // because floor of a double is guaranteed to be a double, and all of - // the values in kInterestingF64s and kFractF64s are doubles. - for (const auto& [input, input_str] : kInterestingF64s) { - ss << printBinaryCase(input_str, calculateBinaryResults(kSubtractionOp, input, floor(input))) << "," << std::endl; - } - for (const auto& [input, input_str] : kFractF64s) { - ss << printBinaryCase(input_str, calculateBinaryResults(kSubtractionOp, input, floor(input))) << "," << std::endl; - } - ss << "END FRACT CASES" << std::endl; - return ss.str(); + std::stringstream ss; + ss << "BEGIN FRACT CASES" << std::endl; + // Do not have to calculate quantization/roundings for floor(input), + // because floor of a double is guaranteed to be a double, and all of + // the values in kInterestingF64s and kFractF64s are doubles. + for (const auto& [input, input_str] : kInterestingF64s) { + ss << printBinaryCase(input_str, calculateBinaryResults( + kSubtractionOp, input, floor(input))) + << "," << std::endl; + } + for (const auto& [input, input_str] : kFractF64s) { + ss << printBinaryCase(input_str, calculateBinaryResults( + kSubtractionOp, input, floor(input))) + << "," << std::endl; + } + ss << "END FRACT CASES" << std::endl; + return ss.str(); } int main() { - assert(sizeof(double) < sizeof(long double) && "Need higher precision long double"); - assert(sizeof(long double) == 16 && "Code assume 'proper' quad support, not some other higher precision floating point implementation"); + assert(sizeof(double) < sizeof(long double) && + "Need higher precision long double"); + assert(sizeof(long double) == 16 && + "Code assume 'proper' quad support, not some other higher precision " + "floating point implementation"); - { - // Confirms that calculating f64 imprecise results generates two possible - // roundings. - const auto [begin, end] = - quantizeToAbstractFloat(static_cast<long double>(0.1) * static_cast<long double>(0.1)); - assert(std::bit_cast<uint64_t>(begin) == 0x3F847AE147AE147bull && - std::bit_cast<uint64_t>(end) == 0x3F847AE147AE147Cull && - "0.1 * 0.1 returned unexpected values"); - } + { + // Confirms that calculating f64 imprecise results generates two possible + // roundings. + const auto [begin, end] = quantizeToAbstractFloat( + static_cast<long double>(0.1) * static_cast<long double>(0.1)); + assert(std::bit_cast<uint64_t>(begin) == 0x3F847AE147AE147bull && + std::bit_cast<uint64_t>(end) == 0x3F847AE147AE147Cull && + "0.1 * 0.1 returned unexpected values"); + } - std::cout << printBinaryOpCases(kAdditionOp, "ADDITION") << std::endl; - std::cout << printBinaryOpCases(kSubtractionOp, "SUBTRACTION") << std::endl; - std::cout << printBinaryOpCases(kMultiplicationOp, "MULTIPLICATION") << std::endl; - std::cout << printFractCases() << std::endl; + std::cout << printBinaryOpCases(kAdditionOp, "ADDITION") << std::endl; + std::cout << printBinaryOpCases(kSubtractionOp, "SUBTRACTION") << std::endl; + std::cout << printBinaryOpCases(kMultiplicationOp, "MULTIPLICATION") + << std::endl; + std::cout << printFractCases() << std::endl; - return 0; + return 0; } diff --git a/editor/txmgr/TransactionItem.cpp b/editor/txmgr/TransactionItem.cpp @@ -44,7 +44,8 @@ NS_IMPL_CYCLE_COLLECTING_NATIVE_RELEASE_WITH_LAST_RELEASE(TransactionItem, NS_IMPL_CYCLE_COLLECTION_CLASS(TransactionItem) - NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(TransactionItem) tmp->CleanUp(); +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(TransactionItem) + tmp->CleanUp(); NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(TransactionItem) diff --git a/gfx/src/nsDeviceContext.h b/gfx/src/nsDeviceContext.h @@ -6,19 +6,19 @@ #ifndef _NS_DEVICECONTEXT_H_ #define _NS_DEVICECONTEXT_H_ -#include <stdint.h> // for uint32_t -#include "gfxTypes.h" // for gfxFloat -#include "mozilla/RefPtr.h" // for RefPtr -#include "nsCOMPtr.h" // for nsCOMPtr -#include "nsCoord.h" // for nscoord -#include "nsError.h" // for nsresult -#include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING -#include "nsMathUtils.h" // for NS_round -#include "nscore.h" // for char16_t, nsAString -#include "mozilla/AppUnits.h" // for AppUnits -#include "nsFontMetrics.h" // for nsFontMetrics::Params -#include "mozilla/gfx/Point.h" // for IntSize -#include "mozilla/gfx/PrintPromise.h" // for PrintEndDocumentPromise +#include <stdint.h> // for uint32_t +#include "gfxTypes.h" // for gfxFloat +#include "mozilla/RefPtr.h" // for RefPtr +#include "nsCOMPtr.h" // for nsCOMPtr +#include "nsCoord.h" // for nscoord +#include "nsError.h" // for nsresult +#include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING +#include "nsMathUtils.h" // for NS_round +#include "nscore.h" // for char16_t, nsAString +#include "mozilla/AppUnits.h" // for AppUnits +#include "nsFontMetrics.h" // for nsFontMetrics::Params +#include "mozilla/gfx/Point.h" // for IntSize +#include "mozilla/gfx/PrintPromise.h" // for PrintEndDocumentPromise class gfxContext; class gfxTextPerfMetrics; diff --git a/gfx/wr/swgl/src/composite.h b/gfx/wr/swgl/src/composite.h @@ -83,7 +83,8 @@ static inline void mask_row(uint32_t* dst, const uint8_t* mask, int span) { dst += 4; } if (dst < end) { - WideRGBA8 maskpx = expand_mask(dst, unpack(partial_load_span<PackedR8>(mask, end - dst))); + WideRGBA8 maskpx = + expand_mask(dst, unpack(partial_load_span<PackedR8>(mask, end - dst))); WideRGBA8 dstpx = unpack(partial_load_span<PackedRGBA8>(dst, end - dst)); auto r = pack(maskpx + dstpx - muldiv255(dstpx, maskpx)); partial_store_span(dst, r, end - dst); @@ -99,9 +100,9 @@ static NO_INLINE void mask_blit(Texture& masktex, Texture& dsttex) { int span = dsttex.width; for (int rows = dsttex.height; rows > 0; rows--) { - mask_row((uint32_t*)dest, (uint8_t*)mask, span); - dest += destStride; - mask += maskStride; + mask_row((uint32_t*)dest, (uint8_t*)mask, span); + dest += destStride; + mask += maskStride; } } diff --git a/gfx/wr/swgl/src/swgl_ext.h b/gfx/wr/swgl/src/swgl_ext.h @@ -1847,74 +1847,77 @@ static bool commitRadialGradient(sampler2D sampler, int address, float size, // It is updated by this function. // - (in/out) initialOffset is the offset of the stop at initalOffset. // It is updated by this function. -static int32_t findGradientStopPair(float offset, float* stops, int32_t numStops, - int32_t& initialIndex, float& initialOffset, - float& prevOffset, float& nextOffset) { - int32_t index = initialIndex; - - // Walk forward or backward depending on where the target offset is relative - // to the initial offset. - if (offset >= initialOffset) { - // Walk the gradient stops forward - float next = stops[initialIndex]; - float prev = stops[max(initialIndex - 1, 0)]; - while (index < numStops) { - if (next > offset) { - break; - } - - index += 1; - prev = next; - next = stops[index]; - } +static int32_t findGradientStopPair(float offset, float* stops, + int32_t numStops, int32_t& initialIndex, + float& initialOffset, float& prevOffset, + float& nextOffset) { + int32_t index = initialIndex; + + // Walk forward or backward depending on where the target offset is relative + // to the initial offset. + if (offset >= initialOffset) { + // Walk the gradient stops forward + float next = stops[initialIndex]; + float prev = stops[max(initialIndex - 1, 0)]; + while (index < numStops) { + if (next > offset) { + break; + } - // We wither: - // - Walked 1 stop past the one we are looking for, so we need to - // adjust the index by decrementing it. - // - Walked past the last stop so the index is out of bounds. We - // don't *have* to decrement it since we are going to clamp it - // at the end of the function but doing it does not break the - // logic either. - index -= 1; - - prevOffset = prev; - nextOffset = next; - } else { - // Walk back. - float next = stops[initialIndex]; - float prev = stops[min(initialIndex + 1, numStops - 1)]; - while (index > 0) { - if (next < offset) { - break; - } + index += 1; + prev = next; + next = stops[index]; + } - index -= 1; - prev = next; - next = stops[index]; - } + // We wither: + // - Walked 1 stop past the one we are looking for, so we need to + // adjust the index by decrementing it. + // - Walked past the last stop so the index is out of bounds. We + // don't *have* to decrement it since we are going to clamp it + // at the end of the function but doing it does not break the + // logic either. + index -= 1; + + prevOffset = prev; + nextOffset = next; + } else { + // Walk back. + float next = stops[initialIndex]; + float prev = stops[min(initialIndex + 1, numStops - 1)]; + while (index > 0) { + if (next < offset) { + break; + } - // Since we are walking backwards, prev and next are swapped. - prevOffset = next; - nextOffset = prev; + index -= 1; + prev = next; + next = stops[index]; } - index = clamp(index, 0, numStops - 2); + // Since we are walking backwards, prev and next are swapped. + prevOffset = next; + nextOffset = prev; + } + + index = clamp(index, 0, numStops - 2); - initialIndex = index; - initialOffset = prevOffset; + initialIndex = index; + initialOffset = prevOffset; - return index; + return index; } // Samples an entire span of a radial gradient. template <bool BLEND> -static bool commitRadialGradientFromStops(sampler2D sampler, int offsetsAddress, int colorsAddress, float stopCount, +static bool commitRadialGradientFromStops(sampler2D sampler, int offsetsAddress, + int colorsAddress, float stopCount, bool repeat, vec2 pos, float radius, uint32_t* buf, int span) { assert(sampler->format == TextureFormat::RGBA32F); // Stop offsets are expected to be stored just after the colors. assert(colorsAddress >= 0 && colorsAddress < offsetsAddress); - assert(offsetsAddress >= 0 && offsetsAddress + (stopCount + 3) / 4 < int(sampler->height * sampler->stride)); + assert(offsetsAddress >= 0 && offsetsAddress + (stopCount + 3) / 4 < + int(sampler->height * sampler->stride)); float* stopOffsets = (float*)&sampler->buf[offsetsAddress]; Float* stopColors = (Float*)&sampler->buf[colorsAddress]; // clang-format off @@ -2027,9 +2030,9 @@ static bool commitRadialGradientFromStops(sampler2D sampler, int offsetsAddress, } else { // Otherwise, we're inside the valid part of the gradient table. - stopIndex = findGradientStopPair(offset.x, stopOffsets, stopCount, - initialIndex, initialOffset, - prevOffset, nextOffset); + stopIndex = + findGradientStopPair(offset.x, stopOffsets, stopCount, initialIndex, + initialOffset, prevOffset, nextOffset); if (t >= middleT) { intercept = startRadius + nextOffset; } else { @@ -2075,7 +2078,7 @@ static bool commitRadialGradientFromStops(sampler2D sampler, int offsetsAddress, // Subtract off the color difference of the beginning of the current span // from the beginning of the gradient. Float colorF = - minColorF - deltaColorF * (startRadius + prevOffset); // TODO + minColorF - deltaColorF * (startRadius + prevOffset); // TODO // Finally, walk over the span accumulating the position dot product and // getting its sqrt as an offset into the color ramp. Since we're already // in BGRA format and scaled to 255, we just need to round to an integer @@ -2084,11 +2087,10 @@ static bool commitRadialGradientFromStops(sampler2D sampler, int offsetsAddress, Float offsetG = fastSqrt<false>(dotPos); commit_blend_span<BLEND>( buf, - combine( - packRGBA8(round_pixel(colorF + deltaColorF * offsetG.x, 1), - round_pixel(colorF + deltaColorF * offsetG.y, 1)), - packRGBA8(round_pixel(colorF + deltaColorF * offsetG.z, 1), - round_pixel(colorF + deltaColorF * offsetG.w, 1)))); + combine(packRGBA8(round_pixel(colorF + deltaColorF * offsetG.x, 1), + round_pixel(colorF + deltaColorF * offsetG.y, 1)), + packRGBA8(round_pixel(colorF + deltaColorF * offsetG.z, 1), + round_pixel(colorF + deltaColorF * offsetG.w, 1)))); dotPos += dotPosDelta; dotPosDelta += deltaDelta2; } @@ -2109,13 +2111,11 @@ static bool commitRadialGradientFromStops(sampler2D sampler, int offsetsAddress, Float offsetG = fastSqrt<false>(dotPos); commit_blend_span<BLEND>( buf, - combine( - packRGBA8(round_pixel(colorF + deltaColorF * offsetG.x, 1), - round_pixel(colorF + deltaColorF * offsetG.y, 1)), - packRGBA8(round_pixel(colorF + deltaColorF * offsetG.z, 1), - round_pixel(colorF + deltaColorF * offsetG.w, 1))), - remainder - ); + combine(packRGBA8(round_pixel(colorF + deltaColorF * offsetG.x, 1), + round_pixel(colorF + deltaColorF * offsetG.y, 1)), + packRGBA8(round_pixel(colorF + deltaColorF * offsetG.z, 1), + round_pixel(colorF + deltaColorF * offsetG.w, 1))), + remainder); buf += remainder; t += remainder; @@ -2155,31 +2155,25 @@ static bool commitRadialGradientFromStops(sampler2D sampler, int offsetsAddress, // swglcommitLinearGradient, but given a varying 2D position scaled to // gradient-space and a radius at which the distance from the origin maps to the // start of the gradient table. -#define swgl_commitRadialGradientFromStopsRGBA8(sampler, offsetsAddress, \ - colorsAddress, size, repeat, \ - pos, radius) \ - do { \ - bool drawn = false; \ - if (blend_key) { \ - drawn = \ - commitRadialGradientFromStops<true>(sampler, offsetsAddress, \ - colorsAddress, size, repeat, \ - pos, radius, swgl_OutRGBA8, \ - swgl_SpanLength); \ - } else { \ - drawn = \ - commitRadialGradientFromStops<false>(sampler, offsetsAddress, \ - colorsAddress, size, repeat, \ - pos, radius, swgl_OutRGBA8, \ - swgl_SpanLength); \ - } \ - if (drawn) { \ - swgl_OutRGBA8 += swgl_SpanLength; \ - swgl_SpanLength = 0; \ - } \ +#define swgl_commitRadialGradientFromStopsRGBA8( \ + sampler, offsetsAddress, colorsAddress, size, repeat, pos, radius) \ + do { \ + bool drawn = false; \ + if (blend_key) { \ + drawn = commitRadialGradientFromStops<true>( \ + sampler, offsetsAddress, colorsAddress, size, repeat, pos, radius, \ + swgl_OutRGBA8, swgl_SpanLength); \ + } else { \ + drawn = commitRadialGradientFromStops<false>( \ + sampler, offsetsAddress, colorsAddress, size, repeat, pos, radius, \ + swgl_OutRGBA8, swgl_SpanLength); \ + } \ + if (drawn) { \ + swgl_OutRGBA8 += swgl_SpanLength; \ + swgl_SpanLength = 0; \ + } \ } while (0) - // Extension to set a clip mask image to be sampled during blending. The offset // specifies the positioning of the clip mask image relative to the viewport // origin. The bounding box specifies the rectangle relative to the clip mask's diff --git a/intl/locale/EncodingToLang.cpp b/intl/locale/EncodingToLang.cpp @@ -20,7 +20,7 @@ using namespace mozilla::intl; // 1. Putting the pointers in a static array in Rust, at a distance. // 2. Run-time initializer. // 3. Using pointer pointers, as seen here. -const mozilla::NotNull<const mozilla::Encoding *> * +const mozilla::NotNull<const mozilla::Encoding*>* EncodingToLang::kEncodingsByRoughFrequency[] = { #define _(encoding, lang) &encoding, #include "EncodingsByFrequency.inc" diff --git a/intl/locale/EncodingToLang.h b/intl/locale/EncodingToLang.h @@ -25,7 +25,7 @@ class EncodingToLang { private: static nsAtom* sLangs[]; - static const mozilla::NotNull<const mozilla::Encoding *> * + static const mozilla::NotNull<const mozilla::Encoding*>* kEncodingsByRoughFrequency[]; }; diff --git a/js/src/jit/BaselineFrame.cpp b/js/src/jit/BaselineFrame.cpp @@ -52,9 +52,11 @@ void BaselineFrame::trace(JSTracer* trc, const JSJitFrameIter& frameIterator) { TraceRoot(trc, &argsObj_, "baseline-args-obj"); } - mozilla::DebugOnly<bool> isBaselineSelfHosted = this->script()->selfHosted() - && !runningInInterpreter(); - MOZ_ASSERT_IF(JS::Prefs::experimental_self_hosted_cache() && isBaselineSelfHosted, isRealmIndependent()); + mozilla::DebugOnly<bool> isBaselineSelfHosted = + this->script()->selfHosted() && !runningInInterpreter(); + MOZ_ASSERT_IF( + JS::Prefs::experimental_self_hosted_cache() && isBaselineSelfHosted, + isRealmIndependent()); if (runningInInterpreter() || isRealmIndependent()) { TraceRoot(trc, &interpreterScript_, "baseline-interpreterScript"); } diff --git a/js/src/wasm/WasmBuiltinModule.cpp b/js/src/wasm/WasmBuiltinModule.cpp @@ -353,7 +353,8 @@ static BuiltinModuleFuncId JSStringFuncs[] = { static const char* JSStringModuleName = "wasm:js-string"; Maybe<BuiltinModuleId> wasm::ImportMatchesBuiltinModule( - mozilla::Span<const char> importName, const BuiltinModuleIds& enabledBuiltins) { + mozilla::Span<const char> importName, + const BuiltinModuleIds& enabledBuiltins) { if (enabledBuiltins.jsString && importName == mozilla::MakeStringSpan(JSStringModuleName)) { return Some(BuiltinModuleId::JSString); @@ -444,7 +445,8 @@ bool wasm::InstantiateBuiltinModule(JSContext* cx, BuiltinModuleId module, return false; } Rooted<ImportValues> imports(cx); - if (!wasm::GetImports(cx, moduleObj->module(), importObj, imports.address())) { + if (!wasm::GetImports(cx, moduleObj->module(), importObj, + imports.address())) { return false; } diff --git a/media/webrtc/signaling/gtest/MockCall.h b/media/webrtc/signaling/gtest/MockCall.h @@ -82,8 +82,8 @@ class MockAudioReceiveStream : public webrtc::AudioReceiveStreamInterface { void SetRtcpMode(webrtc::RtcpMode mode) override {} virtual void SetDepacketizerToDecoderFrameTransformer( - webrtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer) - override { + webrtc::scoped_refptr<webrtc::FrameTransformerInterface> + frame_transformer) override { MOZ_CRASH( "Unimplemented after webrtc.org e2561e17e2 removed the Reconfigure " "method."); @@ -171,8 +171,8 @@ class MockVideoReceiveStream : public webrtc::VideoReceiveStreamInterface { frame_decryptor) override {} void SetDepacketizerToDecoderFrameTransformer( - webrtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer) - override {} + webrtc::scoped_refptr<webrtc::FrameTransformerInterface> + frame_transformer) override {} RecordingState SetAndGetRecordingState(RecordingState state, bool generate_key_frame) override { diff --git a/xpcom/string/nsTDependentSubstring.h b/xpcom/string/nsTDependentSubstring.h @@ -72,8 +72,7 @@ class MOZ_GSL_POINTER nsTDependentSubstring : public nsTSubstring<T> { : substring_type(const_cast<char_type*>(aData), aLength, DataFlags(0), ClassFlags(0)) {} - explicit nsTDependentSubstring( - mozilla::Span<const char_type> aData) + explicit nsTDependentSubstring(mozilla::Span<const char_type> aData) : nsTDependentSubstring(aData.Elements(), aData.Length()) {} nsTDependentSubstring(const char_type* aStart MOZ_LIFETIME_BOUND,