Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
41c60633
Unverified
Commit
41c60633
authored
May 23, 2022
by
gaaclarke
Committed by
GitHub
May 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sped up Element._sort (#104103)
parent
ec20ea80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+14
-8
No files found.
packages/flutter/lib/src/widgets/framework.dart
View file @
41c60633
...
...
@@ -3191,15 +3191,21 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
}
late
int
_depth
;
/// Returns result < 0 when [a] < [b], result == 0 when [a] == [b], result > 0
/// when [a] > [b].
static
int
_sort
(
Element
a
,
Element
b
)
{
if
(
a
.
depth
<
b
.
depth
)
return
-
1
;
if
(
b
.
depth
<
a
.
depth
)
return
1
;
if
(
b
.
dirty
&&
!
a
.
dirty
)
return
-
1
;
if
(
a
.
dirty
&&
!
b
.
dirty
)
return
1
;
final
int
diff
=
a
.
depth
-
b
.
depth
;
// If depths are not equal, return the difference.
if
(
diff
!=
0
)
{
return
diff
;
}
// If the `dirty` values are not equal, sort with non-dirty elements being
// less than dirty elements.
final
bool
isBDirty
=
b
.
dirty
;
if
(
a
.
dirty
!=
isBDirty
)
{
return
isBDirty
?
-
1
:
1
;
}
// Otherwise, `depth`s and `dirty`s are equal.
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment