Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
afd42296
E
engine
项目概览
qq_34031325
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
afd42296
编写于
10月 31, 2017
作者:
I
Ian Hickson
提交者:
GitHub
10月 31, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add TextPosition.== and hashCode, and some text API docs (#4283)
上级
b3d345e3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
67 addition
and
13 deletion
+67
-13
lib/ui/natives.dart
lib/ui/natives.dart
+5
-5
lib/ui/text.dart
lib/ui/text.dart
+58
-6
travis/analyze.sh
travis/analyze.sh
+4
-2
未找到文件。
lib/ui/natives.dart
浏览文件 @
afd42296
...
...
@@ -5,7 +5,7 @@
part of
dart
.
ui
;
// Corelib 'print' implementation.
void
_print
(
arg
)
{
void
_print
(
dynamic
arg
)
{
_Logger
.
_printString
(
arg
.
toString
());
}
...
...
@@ -43,13 +43,13 @@ Uri _getBaseURL() => Uri.parse(_baseURL);
// Required for gen_snapshot to work correctly.
int
_isolateId
;
_getPrintClosure
()
=>
_print
;
_getScheduleMicrotaskClosure
()
=>
_scheduleMicrotask
;
_getGetBaseURLClosure
()
=>
_getBaseURL
;
Function
_getPrintClosure
(
)
=>
_print
;
Function
_getScheduleMicrotaskClosure
(
)
=>
_scheduleMicrotask
;
Function
_getGetBaseURLClosure
(
)
=>
_getBaseURL
;
// Though the "main" symbol is not included in any of the libraries imported
// above, the builtin library will be included manually during VM setup. This
// symbol is only necessary for precompilation. It is marked as a stanalone
// entry point into the VM. This prevents the precompiler from tree shaking
// away "main"
_getMainClosure
()
=>
main
;
Function
_getMainClosure
(
)
=>
main
;
lib/ui/text.dart
浏览文件 @
afd42296
...
...
@@ -154,17 +154,18 @@ class TextDecoration {
/// Draw a line through each line of text
static
const
TextDecoration
lineThrough
=
const
TextDecoration
.
_
(
0x4
);
@override
bool
operator
==(
dynamic
other
)
{
if
(
identical
(
this
,
other
))
return
true
;
if
(
other
is
!
TextDecoration
)
return
false
;
final
TextDecoration
typedOther
=
other
;
return
_mask
==
typedOther
.
_mask
;
}
@override
int
get
hashCode
=>
_mask
.
hashCode
;
@override
String
toString
()
{
if
(
_mask
==
0
)
return
'TextDecoration.none'
;
...
...
@@ -652,7 +653,10 @@ enum TextDirection {
}
/// A rectangle enclosing a run of text.
///
/// This is similar to [Rect] but includes an inherent [TextDirection].
class
TextBox
{
/// Creates an object that describes a box containing text.
const
TextBox
.
fromLTRBD
(
this
.
left
,
this
.
top
,
...
...
@@ -670,12 +674,16 @@ class TextBox {
)
:
direction
=
TextDirection
.
values
[
directionIndex
];
/// The left edge of the text box, irrespective of direction.
///
/// To get the leading edge (which may depend on the [direction]), consider [start].
final
double
left
;
/// The top edge of the text box.
final
double
top
;
/// The right edge of the text box, irrespective of direction.
///
/// To get the trailing edge (which may depend on the [direction]), consider [end].
final
double
right
;
/// The bottom edge of the text box.
...
...
@@ -687,16 +695,25 @@ class TextBox {
/// Returns a rect of the same size as this box.
Rect
toRect
()
=>
new
Rect
.
fromLTRB
(
left
,
top
,
right
,
bottom
);
/// The left edge of the box for ltr text; the right edge of the box for rtl text.
/// The [left] edge of the box for left-to-right text; the [right] edge of the box for right-to-left text.
///
/// See also:
///
/// * [direction], which specifies the text direction.
double
get
start
{
return
(
direction
==
TextDirection
.
ltr
)
?
left
:
right
;
}
/// The right edge of the box for ltr text; the left edge of the box for rtl text.
/// The [right] edge of the box for left-to-right text; the [left] edge of the box for right-to-left text.
///
/// See also:
///
/// * [direction], which specifies the text direction.
double
get
end
{
return
(
direction
==
TextDirection
.
ltr
)
?
right
:
left
;
}
@override
bool
operator
==(
dynamic
other
)
{
if
(
identical
(
this
,
other
))
return
true
;
...
...
@@ -710,8 +727,10 @@ class TextBox {
&&
typedOther
.
direction
==
direction
;
}
@override
int
get
hashCode
=>
hashValues
(
left
,
top
,
right
,
bottom
,
direction
);
@override
String
toString
()
=>
'TextBox.fromLTRBD(
${left.toStringAsFixed(1)}
,
${top.toStringAsFixed(1)}
,
${right.toStringAsFixed(1)}
,
${bottom.toStringAsFixed(1)}
,
$direction
)'
;
}
...
...
@@ -738,15 +757,45 @@ enum TextAffinity {
/// A visual position in a string of text.
class
TextPosition
{
const
TextPosition
({
this
.
offset
,
this
.
affinity
:
TextAffinity
.
downstream
});
/// Creates an object representing a particular position in a string.
///
/// The arguments must not be null (so the [offset] argument is required).
const
TextPosition
({
this
.
offset
,
this
.
affinity
:
TextAffinity
.
downstream
,
})
:
assert
(
offset
!=
null
),
assert
(
affinity
!=
null
);
/// The index of the character just prior to the position.
/// The index of the character that immediately follows the position.
///
/// For example, given the string `'Hello'`, offset 0 represents the cursor
/// being before the `H`, while offset 5 represents the cursor being just
/// after the `o`.
final
int
offset
;
/// If the offset has more than one visual location (e.g., occurs at a line
/// break), which of the two locations is represented by this position.
///
/// For example, if the text `'AB'` had a forced line break between the `A`
/// and the `B`, then the downstream affinity at offset 1 represents the
/// cursor being just after the `A` on the first line, while the upstream
/// affinity at offset 1 represents the cursor being just before the `B` on
/// the first line.
final
TextAffinity
affinity
;
@override
bool
operator
==(
dynamic
other
)
{
if
(
other
.
runtimeType
!=
runtimeType
)
return
false
;
final
TextPosition
typedOther
=
other
;
return
typedOther
.
offset
==
offset
&&
typedOther
.
affinity
==
affinity
;
}
@override
int
get
hashCode
=>
hashValues
(
offset
,
affinity
);
@override
String
toString
()
{
return
'
$runtimeType
(offset:
$offset
, affinity:
$affinity
)'
;
}
...
...
@@ -785,6 +834,7 @@ class ParagraphConstraints {
/// [Paragraph] with a [ParagraphBuilder].
final
double
width
;
@override
bool
operator
==(
dynamic
other
)
{
if
(
other
.
runtimeType
!=
runtimeType
)
return
false
;
...
...
@@ -792,8 +842,10 @@ class ParagraphConstraints {
return
typedOther
.
width
==
width
;
}
@override
int
get
hashCode
=>
width
.
hashCode
;
@override
String
toString
()
=>
'
$runtimeType
(width:
$width
)'
;
}
...
...
travis/analyze.sh
浏览文件 @
afd42296
...
...
@@ -14,16 +14,18 @@ fi
echo
"Analyzing dart:ui library..."
RESULTS
=
`
dartanalyzer
\
--ignore-unrecognized-flags
\
--supermixin
\
--enable-assert-initializers
\
--initializing-formal-access
\
--enable-strict-call-checks
\
--enable_type_checks
\
--strong
\
--no-implicit-dynamic
\
--package-warnings
\
--fatal-warnings
\
--strong-hints
\
--fatal-hints
\
--lints
\
--fatal-lints
\
out/host_debug_unopt/gen/sky/bindings/dart_ui/ui.dart
\
2>&1
\
|
grep
-v
"Native functions can only be declared in the SDK and code that is loaded through native extensions"
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录