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
616a2ad6
Unverified
Commit
616a2ad6
authored
Nov 03, 2017
by
amirh
Committed by
GitHub
Nov 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move semantics stuff from rendering to a top-level semantics/ library (#12793)
parent
79862a72
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
99 additions
and
83 deletions
+99
-83
rendering.dart
packages/flutter/lib/rendering.dart
+1
-1
semantics.dart
packages/flutter/lib/semantics.dart
+16
-0
matrix_utils.dart
packages/flutter/lib/src/painting/matrix_utils.dart
+49
-0
binding.dart
packages/flutter/lib/src/rendering/binding.dart
+1
-1
debug.dart
packages/flutter/lib/src/rendering/debug.dart
+0
-66
editable.dart
packages/flutter/lib/src/rendering/editable.dart
+1
-1
layer.dart
packages/flutter/lib/src/rendering/layer.dart
+0
-2
object.dart
packages/flutter/lib/src/rendering/object.dart
+1
-1
paragraph.dart
packages/flutter/lib/src/rendering/paragraph.dart
+1
-1
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+1
-2
sliver_persistent_header.dart
...s/flutter/lib/src/rendering/sliver_persistent_header.dart
+1
-1
viewport.dart
packages/flutter/lib/src/rendering/viewport.dart
+1
-1
semantics.dart
packages/flutter/lib/src/semantics/semantics.dart
+22
-4
semantics_event.dart
packages/flutter/lib/src/semantics/semantics_event.dart
+0
-0
semantics_test.dart
packages/flutter/test/semantics/semantics_test.dart
+2
-1
semantics_event_test.dart
packages/flutter/test/widgets/semantics_event_test.dart
+1
-1
semantics_test.dart
packages/flutter/test/widgets/semantics_test.dart
+1
-0
No files found.
packages/flutter/lib/rendering.dart
View file @
616a2ad6
...
...
@@ -28,6 +28,7 @@ export 'package:flutter/foundation.dart' show
ValueGetter
,
ValueSetter
,
DiagnosticLevel
;
export
'package:flutter/semantics.dart'
;
export
'package:vector_math/vector_math_64.dart'
show
Matrix4
;
export
'src/rendering/animated_size.dart'
;
...
...
@@ -47,7 +48,6 @@ export 'src/rendering/paragraph.dart';
export
'src/rendering/performance_overlay.dart'
;
export
'src/rendering/proxy_box.dart'
;
export
'src/rendering/rotated_box.dart'
;
export
'src/rendering/semantics.dart'
;
export
'src/rendering/shifted_box.dart'
;
export
'src/rendering/sliver.dart'
;
export
'src/rendering/sliver_fill.dart'
;
...
...
packages/flutter/lib/semantics.dart
0 → 100644
View file @
616a2ad6
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// The Flutter semantics package.
///
/// To use, import `package:flutter/semantics.dart`.
///
/// The [SemanticsEvent] classes define the protocol for sending semantic events
/// to the platform.
///
/// The [SemanticsNode] hierarchy represents the semantic structure of the UI
/// and is used to by the platform-specific accessibility services.
library
semantics
;
export
'src/semantics/semantics.dart'
;
packages/flutter/lib/src/painting/matrix_utils.dart
View file @
616a2ad6
...
...
@@ -5,6 +5,7 @@
import
'dart:math'
as
math
;
import
'dart:typed_data'
;
import
'package:flutter/foundation.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'basic_types.dart'
;
...
...
@@ -169,3 +170,51 @@ class MatrixUtils {
return
transformRect
(
transform
,
rect
);
}
}
/// Returns a list of strings representing the given transform in a format
/// useful for [TransformProperty].
///
/// If the argument is null, returns a list with the single string "null".
List
<
String
>
debugDescribeTransform
(
Matrix4
transform
)
{
if
(
transform
==
null
)
return
const
<
String
>[
'null'
];
final
List
<
String
>
matrix
=
transform
.
toString
().
split
(
'
\n
'
).
map
((
String
s
)
=>
'
$s
'
).
toList
();
matrix
.
removeLast
();
return
matrix
;
}
/// Property which handles [Matrix4] that represent transforms.
class
TransformProperty
extends
DiagnosticsProperty
<
Matrix4
>
{
/// Create a diagnostics property for [Matrix4] objects.
///
/// The [showName] and [level] arguments must not be null.
TransformProperty
(
String
name
,
Matrix4
value
,
{
bool
showName:
true
,
Object
defaultValue:
kNoDefaultValue
,
DiagnosticLevel
level:
DiagnosticLevel
.
info
,
})
:
assert
(
showName
!=
null
),
assert
(
level
!=
null
),
super
(
name
,
value
,
showName:
showName
,
defaultValue:
defaultValue
,
level:
level
,
);
@override
String
valueToString
({
TextTreeConfiguration
parentConfiguration
})
{
if
(
parentConfiguration
!=
null
&&
!
parentConfiguration
.
lineBreakProperties
)
{
// Format the value on a single line to be compatible with the parent's
// style.
final
List
<
Vector4
>
rows
=
<
Vector4
>[
value
.
getRow
(
0
),
value
.
getRow
(
1
),
value
.
getRow
(
2
),
value
.
getRow
(
3
),
];
return
'[
${rows.join("; ")}
]'
;
}
return
debugDescribeTransform
(
value
).
join
(
'
\n
'
);
}
}
packages/flutter/lib/src/rendering/binding.dart
View file @
616a2ad6
...
...
@@ -9,12 +9,12 @@ import 'dart:ui' as ui show window;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'package:flutter/semantics.dart'
;
import
'package:flutter/services.dart'
;
import
'box.dart'
;
import
'debug.dart'
;
import
'object.dart'
;
import
'semantics.dart'
;
import
'view.dart'
;
export
'package:flutter/gestures.dart'
show
HitTestResult
;
...
...
packages/flutter/lib/src/rendering/debug.dart
View file @
616a2ad6
...
...
@@ -4,30 +4,12 @@
import
'package:flutter/foundation.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
export
'package:flutter/foundation.dart'
show
debugPrint
;
// Any changes to this file should be reflected in the debugAssertAllRenderVarsUnset()
// function below.
/// Used by [debugDumpSemanticsTree] to specify the order in which child nodes
/// are printed.
enum
DebugSemanticsDumpOrder
{
/// Print nodes in inverse hit test order.
///
/// In inverse hit test order, the last child of a [SemanticsNode] will be
/// asked first if it wants to respond to a user's interaction, followed by
/// the second last, etc. until a taker is found.
inverseHitTest
,
/// Print nodes in traversal order.
///
/// Traversal order defines how the user can move the accessibility focus from
/// one node to another.
traversal
,
}
const
HSVColor
_kDebugDefaultRepaintColor
=
const
HSVColor
.
fromAHSV
(
0.4
,
60.0
,
1.0
,
1.0
);
/// Causes each RenderBox to paint a box around its bounds, and some extra
...
...
@@ -130,54 +112,6 @@ bool debugCheckIntrinsicSizes = false;
bool
debugProfilePaintsEnabled
=
false
;
/// Returns a list of strings representing the given transform in a format
/// useful for [TransformProperty].
///
/// If the argument is null, returns a list with the single string "null".
List
<
String
>
debugDescribeTransform
(
Matrix4
transform
)
{
if
(
transform
==
null
)
return
const
<
String
>[
'null'
];
final
List
<
String
>
matrix
=
transform
.
toString
().
split
(
'
\n
'
).
map
((
String
s
)
=>
'
$s
'
).
toList
();
matrix
.
removeLast
();
return
matrix
;
}
/// Property which handles [Matrix4] that represent transforms.
class
TransformProperty
extends
DiagnosticsProperty
<
Matrix4
>
{
/// Create a diagnostics property for [Matrix4] objects.
///
/// The [showName] and [level] arguments must not be null.
TransformProperty
(
String
name
,
Matrix4
value
,
{
bool
showName:
true
,
Object
defaultValue:
kNoDefaultValue
,
DiagnosticLevel
level:
DiagnosticLevel
.
info
,
})
:
assert
(
showName
!=
null
),
assert
(
level
!=
null
),
super
(
name
,
value
,
showName:
showName
,
defaultValue:
defaultValue
,
level:
level
,
);
@override
String
valueToString
({
TextTreeConfiguration
parentConfiguration
})
{
if
(
parentConfiguration
!=
null
&&
!
parentConfiguration
.
lineBreakProperties
)
{
// Format the value on a single line to be compatible with the parent's
// style.
final
List
<
Vector4
>
rows
=
<
Vector4
>[
value
.
getRow
(
0
),
value
.
getRow
(
1
),
value
.
getRow
(
2
),
value
.
getRow
(
3
),
];
return
'[
${rows.join("; ")}
]'
;
}
return
debugDescribeTransform
(
value
).
join
(
'
\n
'
);
}
}
void
_debugDrawDoubleRect
(
Canvas
canvas
,
Rect
outerRect
,
Rect
innerRect
,
Color
color
)
{
final
Path
path
=
new
Path
()
..
fillType
=
PathFillType
.
evenOdd
...
...
packages/flutter/lib/src/rendering/editable.dart
View file @
616a2ad6
...
...
@@ -7,11 +7,11 @@ import 'dart:ui' as ui show TextBox;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/semantics.dart'
;
import
'package:flutter/services.dart'
;
import
'box.dart'
;
import
'object.dart'
;
import
'semantics.dart'
;
import
'viewport_offset.dart'
;
const
double
_kCaretGap
=
1.0
;
// pixels
...
...
packages/flutter/lib/src/rendering/layer.dart
View file @
616a2ad6
...
...
@@ -10,8 +10,6 @@ import 'package:flutter/foundation.dart';
import
'package:flutter/painting.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'debug.dart'
;
/// A composited layer.
///
/// During painting, the render tree generates a tree of composited layers that
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
616a2ad6
...
...
@@ -9,12 +9,12 @@ import 'package:flutter/foundation.dart';
import
'package:flutter/gestures.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'package:flutter/semantics.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'binding.dart'
;
import
'debug.dart'
;
import
'layer.dart'
;
import
'semantics.dart'
;
export
'package:flutter/foundation.dart'
show
FlutterError
,
InformationCollector
,
DiagnosticsNode
,
DiagnosticsProperty
,
StringProperty
,
DoubleProperty
,
EnumProperty
,
FlagProperty
,
IntProperty
,
DiagnosticPropertiesBuilder
;
export
'package:flutter/gestures.dart'
show
HitTestEntry
,
HitTestResult
;
...
...
packages/flutter/lib/src/rendering/paragraph.dart
View file @
616a2ad6
...
...
@@ -6,13 +6,13 @@ import 'dart:ui' as ui show Gradient, Shader, TextBox;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/semantics.dart'
;
import
'package:flutter/services.dart'
;
import
'box.dart'
;
import
'debug.dart'
;
import
'object.dart'
;
import
'semantics.dart'
;
/// How overflowing text should be handled.
enum
TextOverflow
{
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
616a2ad6
...
...
@@ -7,15 +7,14 @@ import 'dart:ui' as ui show ImageFilter, Gradient;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter/semantics.dart'
;
import
'package:flutter/services.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'box.dart'
;
import
'debug.dart'
;
import
'layer.dart'
;
import
'object.dart'
;
import
'semantics.dart'
;
export
'package:flutter/gestures.dart'
show
PointerEvent
,
...
...
packages/flutter/lib/src/rendering/sliver_persistent_header.dart
View file @
616a2ad6
...
...
@@ -8,13 +8,13 @@ import 'package:flutter/animation.dart';
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'package:flutter/semantics.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'binding.dart'
;
import
'box.dart'
;
import
'object.dart'
;
import
'proxy_box.dart'
;
import
'semantics.dart'
;
import
'sliver.dart'
;
import
'viewport_offset.dart'
;
...
...
packages/flutter/lib/src/rendering/viewport.dart
View file @
616a2ad6
...
...
@@ -6,13 +6,13 @@ import 'dart:math' as math;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/semantics.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'binding.dart'
;
import
'box.dart'
;
import
'object.dart'
;
import
'proxy_box.dart'
;
import
'semantics.dart'
;
import
'sliver.dart'
;
import
'viewport_offset.dart'
;
...
...
packages/flutter/lib/src/
rendering
/semantics.dart
→
packages/flutter/lib/src/
semantics
/semantics.dart
View file @
616a2ad6
...
...
@@ -4,14 +4,15 @@
import
'dart:typed_data'
;
import
'dart:ui'
as
ui
;
import
'dart:ui'
show
Rect
,
SemanticsAction
,
SemanticsFlags
;
import
'dart:ui'
show
Offset
,
Rect
,
SemanticsAction
,
SemanticsFlags
,
TextDirection
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter/painting.dart'
show
MatrixUtils
,
TransformProperty
;
import
'package:flutter/services.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'debug.dart'
;
import
'semantics_event.dart'
;
export
'dart:ui'
show
SemanticsAction
;
...
...
@@ -197,7 +198,7 @@ class SemanticsData extends Diagnosticable {
}
@override
int
get
hashCode
=>
hashValues
(
flags
,
actions
,
label
,
textDirection
,
rect
,
tags
,
transform
);
int
get
hashCode
=>
ui
.
hashValues
(
flags
,
actions
,
label
,
textDirection
,
rect
,
tags
,
transform
);
}
class
_SemanticsDiagnosticableNode
extends
DiagnosticableNode
<
SemanticsNode
>
{
...
...
@@ -1376,6 +1377,23 @@ class SemanticsConfiguration {
}
}
/// Used by [debugDumpSemanticsTree] to specify the order in which child nodes
/// are printed.
enum
DebugSemanticsDumpOrder
{
/// Print nodes in inverse hit test order.
///
/// In inverse hit test order, the last child of a [SemanticsNode] will be
/// asked first if it wants to respond to a user's interaction, followed by
/// the second last, etc. until a taker is found.
inverseHitTest
,
/// Print nodes in traversal order.
///
/// Traversal order defines how the user can move the accessibility focus from
/// one node to another.
traversal
,
}
String
_concatStrings
(
{
@required
String
thisString
,
@required
String
otherString
,
...
...
packages/flutter/lib/src/
rendering
/semantics_event.dart
→
packages/flutter/lib/src/
semantics
/semantics_event.dart
View file @
616a2ad6
File moved
packages/flutter/test/
rendering
/semantics_test.dart
→
packages/flutter/test/
semantics
/semantics_test.dart
View file @
616a2ad6
...
...
@@ -3,10 +3,11 @@
// found in the LICENSE file.
import
'package:flutter/rendering.dart'
;
import
'package:flutter/semantics.dart'
;
import
'package:test/test.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'rendering_tester.dart'
;
import
'
../rendering/
rendering_tester.dart'
;
void
main
(
)
{
...
...
packages/flutter/test/widgets/semantics_event_test.dart
View file @
616a2ad6
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/
rendering
.dart'
;
import
'package:flutter/
semantics
.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
...
...
packages/flutter/test/widgets/semantics_test.dart
View file @
616a2ad6
...
...
@@ -4,6 +4,7 @@
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/semantics.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
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