mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Enforce clang-format on all files in commit (#5495)
* Enforce clang-format on all files in commit This re-enforces clang-format across all files changed in the commit. In c10c417, we enabled checking only for the lines changed in the diff in order to reduce the change of merge conflicts with the shell refactor landed in 58e84c8. * Reformat sources to match latest clang-format As part of re-enabling clang-format across the codebase, reformat all code to match the latest toolchain.
This commit is contained in:
parent
e634c281ef
commit
d328f4e64f
@ -83,13 +83,14 @@ using namespace shell;
|
||||
}
|
||||
|
||||
if (@available(iOS 10, *)) {
|
||||
if ([@"HapticFeedbackType.lightImpact" isEqualToString: feedbackType]) {
|
||||
if ([@"HapticFeedbackType.lightImpact" isEqualToString:feedbackType]) {
|
||||
[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight] impactOccurred];
|
||||
} else if ([@"HapticFeedbackType.mediumImpact" isEqualToString: feedbackType]) {
|
||||
[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium] impactOccurred];
|
||||
} else if ([@"HapticFeedbackType.heavyImpact" isEqualToString: feedbackType]) {
|
||||
} else if ([@"HapticFeedbackType.mediumImpact" isEqualToString:feedbackType]) {
|
||||
[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium]
|
||||
impactOccurred];
|
||||
} else if ([@"HapticFeedbackType.heavyImpact" isEqualToString:feedbackType]) {
|
||||
[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleHeavy] impactOccurred];
|
||||
} else if ([@"HapticFeedbackType.selectionClick" isEqualToString: feedbackType]) {
|
||||
} else if ([@"HapticFeedbackType.selectionClick" isEqualToString:feedbackType]) {
|
||||
[[[UISelectionFeedbackGenerator alloc] init] selectionChanged];
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ static UITextAutocapitalizationType ToUITextAutocapitalizationType(NSString* inp
|
||||
|
||||
@end
|
||||
|
||||
@interface FlutterTextInputView : UIView<UITextInput>
|
||||
@interface FlutterTextInputView : UIView <UITextInput>
|
||||
|
||||
// UITextInput
|
||||
@property(nonatomic, readonly) NSMutableString* text;
|
||||
|
||||
@ -159,7 +159,8 @@ blink::SemanticsAction GetSemanticsActionForScrollDirection(
|
||||
// We enforce in the framework that no other useful semantics are merged with these nodes.
|
||||
if ([self node].HasFlag(blink::SemanticsFlags::kScopesRoute))
|
||||
return false;
|
||||
return ([self node].flags != 0 && [self node].flags != static_cast<int32_t>(blink::SemanticsFlags::kIsHidden)) ||
|
||||
return ([self node].flags != 0 &&
|
||||
[self node].flags != static_cast<int32_t>(blink::SemanticsFlags::kIsHidden)) ||
|
||||
![self node].label.empty() || ![self node].value.empty() || ![self node].hint.empty() ||
|
||||
([self node].actions & ~blink::kScrollableSemanticsActions) != 0;
|
||||
}
|
||||
@ -219,7 +220,7 @@ blink::SemanticsAction GetSemanticsActionForScrollDirection(
|
||||
return [self globalRect];
|
||||
}
|
||||
|
||||
- (CGRect) globalRect {
|
||||
- (CGRect)globalRect {
|
||||
SkMatrix44 globalTransform = [self node].transform;
|
||||
for (SemanticsObject* parent = [self parent]; parent; parent = parent.parent) {
|
||||
globalTransform = parent.node.transform * globalTransform;
|
||||
@ -513,7 +514,8 @@ void AccessibilityBridge::UpdateSemantics(blink::SemanticsNodeUpdates nodes) {
|
||||
NSMutableArray<SemanticsObject*>* newRoutes = [[[NSMutableArray alloc] init] autorelease];
|
||||
[root collectRoutes:newRoutes];
|
||||
for (SemanticsObject* route in newRoutes) {
|
||||
if (std::find(previous_routes_.begin(), previous_routes_.end(), [route uid]) != previous_routes_.end()) {
|
||||
if (std::find(previous_routes_.begin(), previous_routes_.end(), [route uid]) !=
|
||||
previous_routes_.end()) {
|
||||
lastAdded = route;
|
||||
}
|
||||
}
|
||||
@ -522,8 +524,8 @@ void AccessibilityBridge::UpdateSemantics(blink::SemanticsNodeUpdates nodes) {
|
||||
lastAdded = [newRoutes objectAtIndex:index];
|
||||
}
|
||||
if (lastAdded != nil && [lastAdded uid] != previous_route_id_) {
|
||||
previous_route_id_ = [lastAdded uid];
|
||||
routeChanged = true;
|
||||
previous_route_id_ = [lastAdded uid];
|
||||
routeChanged = true;
|
||||
}
|
||||
previous_routes_.clear();
|
||||
for (SemanticsObject* route in newRoutes) {
|
||||
|
||||
@ -261,7 +261,8 @@
|
||||
// Adding UIAccessibilityTraitKeyboardKey to the trait list so that iOS treats it like
|
||||
// a keyboard entry control, thus adding support for text editing features, such as
|
||||
// pinch to select text, and up/down fling to move cursor.
|
||||
return [super accessibilityTraits] | [self textInputSurrogate].accessibilityTraits | UIAccessibilityTraitKeyboardKey;
|
||||
return [super accessibilityTraits] | [self textInputSurrogate].accessibilityTraits |
|
||||
UIAccessibilityTraitKeyboardKey;
|
||||
}
|
||||
|
||||
#pragma mark - UITextInput overrides
|
||||
|
||||
@ -27,17 +27,26 @@ esac
|
||||
|
||||
# Tools
|
||||
CLANG_FORMAT="../buildtools/$OS/clang/bin/clang-format"
|
||||
CLANG_FORMAT_DIFF="../buildtools/$OS/clang/share/clang/clang-format-diff.py"
|
||||
$CLANG_FORMAT --version
|
||||
|
||||
# Compute the diffs.
|
||||
FILETYPES="*.c *.cc *.cpp *.h *.m *.mm"
|
||||
DIFF_OPTS="-U0 --no-color"
|
||||
DIFFS="$(git diff $DIFF_OPTS -- master $FILETYPES | "$CLANG_FORMAT_DIFF" -p1 -binary "$CLANG_FORMAT")"
|
||||
DIFF_OPTS="-U0 --no-color --name-only"
|
||||
FILES_TO_CHECK="$(git diff $DIFF_OPTS -- master $FILETYPES)"
|
||||
|
||||
if [[ ! -z "$DIFFS" ]]; then
|
||||
FAILED_CHECKS=0
|
||||
for f in $FILES_TO_CHECK; do
|
||||
set +e
|
||||
CUR_DIFF="$(diff -u "$f" <("$CLANG_FORMAT" --style=file "$f"))"
|
||||
set -e
|
||||
if [[ ! -z "$CUR_DIFF" ]]; then
|
||||
echo "$CUR_DIFF"
|
||||
FAILED_CHECKS=$(($FAILED_CHECKS+1))
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $FAILED_CHECKS -ne 0 ]]; then
|
||||
echo ""
|
||||
echo "ERROR: Some files are formatted incorrectly. To fix, apply diffs below via patch -p0:"
|
||||
echo "$DIFFS"
|
||||
echo "ERROR: Some files are formatted incorrectly. To fix, apply diffs above via patch -p0."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user