Skip to content

Commit 7252263

Browse files
committed
format forked chromium accessibility code
1 parent 8373219 commit 7252263

36 files changed

+404
-615
lines changed

third_party/accessibility/base/numerics/checked_math.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -370,23 +370,23 @@ L* operator-(L* lhs, const StrictNumeric<R> rhs) {
370370

371371
} // namespace internal
372372

373+
using internal::CheckAdd;
374+
using internal::CheckAnd;
375+
using internal::CheckDiv;
373376
using internal::CheckedNumeric;
374-
using internal::IsValidForType;
375-
using internal::ValueOrDieForType;
376-
using internal::ValueOrDefaultForType;
377-
using internal::MakeCheckedNum;
377+
using internal::CheckLsh;
378378
using internal::CheckMax;
379379
using internal::CheckMin;
380-
using internal::CheckAdd;
381-
using internal::CheckSub;
382-
using internal::CheckMul;
383-
using internal::CheckDiv;
384380
using internal::CheckMod;
385-
using internal::CheckLsh;
386-
using internal::CheckRsh;
387-
using internal::CheckAnd;
381+
using internal::CheckMul;
388382
using internal::CheckOr;
383+
using internal::CheckRsh;
384+
using internal::CheckSub;
389385
using internal::CheckXor;
386+
using internal::IsValidForType;
387+
using internal::MakeCheckedNum;
388+
using internal::ValueOrDefaultForType;
389+
using internal::ValueOrDieForType;
390390

391391
} // namespace base
392392

third_party/accessibility/base/numerics/clamped_math.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,20 +244,20 @@ BASE_NUMERIC_COMPARISON_OPERATORS(Clamped, IsNotEqual, !=)
244244

245245
} // namespace internal
246246

247+
using internal::ClampAdd;
248+
using internal::ClampAnd;
249+
using internal::ClampDiv;
247250
using internal::ClampedNumeric;
248-
using internal::MakeClampedNum;
251+
using internal::ClampLsh;
249252
using internal::ClampMax;
250253
using internal::ClampMin;
251-
using internal::ClampAdd;
252-
using internal::ClampSub;
253-
using internal::ClampMul;
254-
using internal::ClampDiv;
255254
using internal::ClampMod;
256-
using internal::ClampLsh;
257-
using internal::ClampRsh;
258-
using internal::ClampAnd;
255+
using internal::ClampMul;
259256
using internal::ClampOr;
257+
using internal::ClampRsh;
258+
using internal::ClampSub;
260259
using internal::ClampXor;
260+
using internal::MakeClampedNum;
261261

262262
} // namespace base
263263

third_party/accessibility/base/numerics/safe_conversions.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ struct SaturateFastOp<
171171
std::is_integral<Dst>::value &&
172172
SaturateFastAsmOp<Dst, Src>::is_supported>::type> {
173173
static constexpr bool is_supported = true;
174-
static constexpr Dst Do(Src value) { return SaturateFastAsmOp<Dst, Src>::Do(value); }
174+
static constexpr Dst Do(Src value) {
175+
return SaturateFastAsmOp<Dst, Src>::Do(value);
176+
}
175177
};
176178

177179
template <typename Dst, typename Src>
@@ -343,14 +345,14 @@ BASE_NUMERIC_COMPARISON_OPERATORS(Strict, IsNotEqual, !=)
343345
using internal::as_signed;
344346
using internal::as_unsigned;
345347
using internal::checked_cast;
346-
using internal::strict_cast;
347-
using internal::saturated_cast;
348-
using internal::SafeUnsignedAbs;
349-
using internal::StrictNumeric;
350-
using internal::MakeStrictNum;
351-
using internal::IsValueInRangeForNumericType;
352348
using internal::IsTypeInRangeForNumericType;
349+
using internal::IsValueInRangeForNumericType;
353350
using internal::IsValueNegative;
351+
using internal::MakeStrictNum;
352+
using internal::SafeUnsignedAbs;
353+
using internal::saturated_cast;
354+
using internal::strict_cast;
355+
using internal::StrictNumeric;
354356

355357
// Explicitly make a shorter size_t alias for convenience.
356358
using SizeT = StrictNumeric<size_t>;

third_party/accessibility/base/numerics/safe_conversions_arm_impl.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,18 @@ struct SaturateFastAsmOp {
3030
uint32_t>::type result;
3131
if (std::is_signed<Dst>::value) {
3232
asm("ssat %[dst], %[shift], %[src]"
33-
: [dst] "=r"(result)
34-
: [src] "r"(src), [shift] "n"(IntegerBitsPlusSign<Dst>::value <= 32
35-
? IntegerBitsPlusSign<Dst>::value
36-
: 32));
33+
: [ dst ] "=r"(result)
34+
:
35+
[ src ] "r"(src), [ shift ] "n"(IntegerBitsPlusSign<Dst>::value <= 32
36+
? IntegerBitsPlusSign<Dst>::value
37+
: 32));
3738
} else {
3839
asm("usat %[dst], %[shift], %[src]"
39-
: [dst] "=r"(result)
40-
: [src] "r"(src), [shift] "n"(IntegerBitsPlusSign<Dst>::value < 32
41-
? IntegerBitsPlusSign<Dst>::value
42-
: 31));
40+
: [ dst ] "=r"(result)
41+
:
42+
[ src ] "r"(src), [ shift ] "n"(IntegerBitsPlusSign<Dst>::value < 32
43+
? IntegerBitsPlusSign<Dst>::value
44+
: 31));
4345
}
4446
return static_cast<Dst>(result);
4547
}

third_party/accessibility/base/numerics/safe_conversions_impl.h

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ struct NarrowingRange {
276276

277277
template <typename Dst,
278278
typename Src,
279-
template <typename> class Bounds,
279+
template <typename>
280+
class Bounds,
280281
IntegerRepresentation DstSign = std::is_signed<Dst>::value
281282
? INTEGER_REPRESENTATION_SIGNED
282283
: INTEGER_REPRESENTATION_UNSIGNED,
@@ -294,7 +295,8 @@ struct DstRangeRelationToSrcRangeImpl;
294295
// Same sign narrowing: The range is contained for normal limits.
295296
template <typename Dst,
296297
typename Src,
297-
template <typename> class Bounds,
298+
template <typename>
299+
class Bounds,
298300
IntegerRepresentation DstSign,
299301
IntegerRepresentation SrcSign>
300302
struct DstRangeRelationToSrcRangeImpl<Dst,
@@ -692,9 +694,8 @@ constexpr bool IsLessImpl(const L lhs,
692694
const RangeCheck l_range,
693695
const RangeCheck r_range) {
694696
return l_range.IsUnderflow() || r_range.IsOverflow() ||
695-
(l_range == r_range &&
696-
static_cast<decltype(lhs + rhs)>(lhs) <
697-
static_cast<decltype(lhs + rhs)>(rhs));
697+
(l_range == r_range && static_cast<decltype(lhs + rhs)>(lhs) <
698+
static_cast<decltype(lhs + rhs)>(rhs));
698699
}
699700

700701
template <typename L, typename R>
@@ -713,9 +714,8 @@ constexpr bool IsLessOrEqualImpl(const L lhs,
713714
const RangeCheck l_range,
714715
const RangeCheck r_range) {
715716
return l_range.IsUnderflow() || r_range.IsOverflow() ||
716-
(l_range == r_range &&
717-
static_cast<decltype(lhs + rhs)>(lhs) <=
718-
static_cast<decltype(lhs + rhs)>(rhs));
717+
(l_range == r_range && static_cast<decltype(lhs + rhs)>(lhs) <=
718+
static_cast<decltype(lhs + rhs)>(rhs));
719719
}
720720

721721
template <typename L, typename R>
@@ -734,9 +734,8 @@ constexpr bool IsGreaterImpl(const L lhs,
734734
const RangeCheck l_range,
735735
const RangeCheck r_range) {
736736
return l_range.IsOverflow() || r_range.IsUnderflow() ||
737-
(l_range == r_range &&
738-
static_cast<decltype(lhs + rhs)>(lhs) >
739-
static_cast<decltype(lhs + rhs)>(rhs));
737+
(l_range == r_range && static_cast<decltype(lhs + rhs)>(lhs) >
738+
static_cast<decltype(lhs + rhs)>(rhs));
740739
}
741740

742741
template <typename L, typename R>
@@ -755,9 +754,8 @@ constexpr bool IsGreaterOrEqualImpl(const L lhs,
755754
const RangeCheck l_range,
756755
const RangeCheck r_range) {
757756
return l_range.IsOverflow() || r_range.IsUnderflow() ||
758-
(l_range == r_range &&
759-
static_cast<decltype(lhs + rhs)>(lhs) >=
760-
static_cast<decltype(lhs + rhs)>(rhs));
757+
(l_range == r_range && static_cast<decltype(lhs + rhs)>(lhs) >=
758+
static_cast<decltype(lhs + rhs)>(rhs));
761759
}
762760

763761
template <typename L, typename R>

third_party/accessibility/base/numerics/safe_math_arm_impl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ struct ClampedAddFastAsmOp {
6161
int32_t y_i32 = checked_cast<int32_t>(y);
6262

6363
asm("qadd %[result], %[first], %[second]"
64-
: [result] "=r"(result)
65-
: [first] "r"(x_i32), [second] "r"(y_i32));
64+
: [ result ] "=r"(result)
65+
: [ first ] "r"(x_i32), [ second ] "r"(y_i32));
6666
return saturated_cast<V>(result);
6767
}
6868
};
@@ -87,8 +87,8 @@ struct ClampedSubFastAsmOp {
8787
int32_t y_i32 = checked_cast<int32_t>(y);
8888

8989
asm("qsub %[result], %[first], %[second]"
90-
: [result] "=r"(result)
91-
: [first] "r"(x_i32), [second] "r"(y_i32));
90+
: [ result ] "=r"(result)
91+
: [ first ] "r"(x_i32), [ second ] "r"(y_i32));
9292
return saturated_cast<V>(result);
9393
}
9494
};

third_party/accessibility/base/numerics/safe_math_shared_impl.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
// Optimized safe math instructions are incompatible with asmjs.
2323
#define BASE_HAS_OPTIMIZED_SAFE_MATH (0)
2424
// Where available use builtin math overflow support on Clang and GCC.
25-
#elif !defined(__native_client__) && \
26-
((defined(__clang__) && \
27-
((__clang_major__ > 3) || \
28-
(__clang_major__ == 3 && __clang_minor__ >= 4))) || \
29-
(defined(__GNUC__) && __GNUC__ >= 5))
25+
#elif !defined(__native_client__) && \
26+
((defined(__clang__) && \
27+
((__clang_major__ > 3) || \
28+
(__clang_major__ == 3 && __clang_minor__ >= 4))) || \
29+
(defined(__GNUC__) && __GNUC__ >= 5))
3030
#include "base/numerics/safe_math_clang_gcc_impl.h"
3131
#define BASE_HAS_OPTIMIZED_SAFE_MATH (1)
3232
#else

third_party/accessibility/gfx/geometry/insets.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace gfx {
1111

1212
std::string Insets::ToString() const {
1313
// Print members in the same order of the constructor parameters.
14-
return base::StringPrintf("%d,%d,%d,%d", top(), left(), bottom(), right());
14+
return base::StringPrintf("%d,%d,%d,%d", top(), left(), bottom(), right());
1515
}
1616

1717
Insets Insets::Offset(const gfx::Vector2d& vector) const {

third_party/accessibility/gfx/geometry/insets.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ class GEOMETRY_EXPORT Insets {
8585
bottom_ == insets.bottom_ && right_ == insets.right_;
8686
}
8787

88-
bool operator!=(const Insets& insets) const {
89-
return !(*this == insets);
90-
}
88+
bool operator!=(const Insets& insets) const { return !(*this == insets); }
9189

9290
void operator+=(const Insets& insets) {
9391
top_ = base::ClampAdd(top_, insets.top_);

third_party/accessibility/gfx/geometry/insets_f.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace gfx {
1010

1111
std::string InsetsF::ToString() const {
1212
// Print members in the same order of the constructor parameters.
13-
return base::StringPrintf("%f,%f,%f,%f", top(), left(), bottom(), right());
13+
return base::StringPrintf("%f,%f,%f,%f", top(), left(), bottom(), right());
1414
}
1515

1616
} // namespace gfx

0 commit comments

Comments
 (0)