Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
cd34b0ef
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,发现更多精彩内容 >>
提交
cd34b0ef
编写于
2月 03, 2017
作者:
J
Jason Simmons
提交者:
GitHub
2月 03, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove ParagraphStyle.lineCount, which has been superseded by maxLines (#3390)
Fixes
https://github.com/flutter/flutter/issues/7723
上级
d317fb3b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
40 deletion
+21
-40
lib/ui/text.dart
lib/ui/text.dart
+14
-27
lib/ui/text/paragraph_builder.cc
lib/ui/text/paragraph_builder.cc
+7
-11
lib/ui/text/paragraph_builder.h
lib/ui/text/paragraph_builder.h
+0
-2
未找到文件。
lib/ui/text.dart
浏览文件 @
cd34b0ef
...
...
@@ -378,16 +378,15 @@ class TextStyle {
//
// - Element 3: The enum index of the |fontStyle|.
//
// - Element 4: The value of |
lineCount
|.
// - Element 4: The value of |
maxLines
|.
//
Int32List
_encodeParagraphStyle
(
TextAlign
textAlign
,
FontWeight
fontWeight
,
FontStyle
fontStyle
,
int
lineCount
,
int
maxLines
,
String
fontFamily
,
double
fontSize
,
double
lineHeight
,
int
maxLines
,
String
ellipsis
)
{
Int32List
result
=
new
Int32List
(
5
);
if
(
textAlign
!=
null
)
{
...
...
@@ -402,9 +401,9 @@ Int32List _encodeParagraphStyle(TextAlign textAlign,
result
[
0
]
|=
1
<<
3
;
result
[
3
]
=
fontStyle
.
index
;
}
if
(
lineCount
!=
null
)
{
if
(
maxLines
!=
null
)
{
result
[
0
]
|=
1
<<
4
;
result
[
4
]
=
lineCount
;
result
[
4
]
=
maxLines
;
}
if
(
fontFamily
!=
null
)
{
result
[
0
]
|=
1
<<
5
;
...
...
@@ -418,12 +417,8 @@ Int32List _encodeParagraphStyle(TextAlign textAlign,
result
[
0
]
|=
1
<<
7
;
// Passed separately to native.
}
if
(
maxLines
!=
null
)
{
result
[
0
]
|=
1
<<
8
;
// Passed separately to native.
}
if
(
ellipsis
!=
null
)
{
result
[
0
]
|=
1
<<
9
;
result
[
0
]
|=
1
<<
8
;
// Passed separately to native.
}
return
result
;
...
...
@@ -436,7 +431,7 @@ class ParagraphStyle {
/// * `textAlign`: The alignment of the text within the lines of the paragraph.
/// * `fontWeight`: The typeface thickness to use when painting the text (e.g., bold).
/// * `fontStyle`: The typeface variant to use when drawing the letters (e.g., italics).
/// * `
lineCount`: Currently not impleme
nted.
/// * `
maxLines`: The maximum number of lines pai
nted.
/// * `fontFamily`: The name of the font to use when painting the text (e.g., Roboto).
/// * `fontSize`: The size of glyphs (in logical pixels) to use when painting the text.
/// * `lineHeight`: The minimum height of the line boxes, as a multiple of the font size.
...
...
@@ -445,34 +440,28 @@ class ParagraphStyle {
TextAlign
textAlign
,
FontWeight
fontWeight
,
FontStyle
fontStyle
,
int
lineCount
,
int
maxLines
,
String
fontFamily
,
double
fontSize
,
double
lineHeight
,
int
maxLines
,
String
ellipsis
})
:
_encoded
=
_encodeParagraphStyle
(
textAlign
,
fontWeight
,
fontStyle
,
lineCount
,
maxLines
,
fontFamily
,
fontSize
,
lineHeight
,
maxLines
,
ellipsis
),
_fontFamily
=
fontFamily
,
_fontSize
=
fontSize
,
_lineHeight
=
lineHeight
,
_maxLines
=
maxLines
,
_ellipsis
=
ellipsis
{
assert
(
lineCount
==
null
);
}
_ellipsis
=
ellipsis
;
final
Int32List
_encoded
;
final
String
_fontFamily
;
final
double
_fontSize
;
final
double
_lineHeight
;
final
int
_maxLines
;
final
String
_ellipsis
;
bool
operator
==(
dynamic
other
)
{
...
...
@@ -484,7 +473,6 @@ class ParagraphStyle {
if
(
_fontFamily
!=
typedOther
.
_fontFamily
||
_fontSize
!=
typedOther
.
_fontSize
||
_lineHeight
!=
typedOther
.
_lineHeight
||
_maxLines
!=
typedOther
.
_maxLines
||
_ellipsis
!=
typedOther
.
_ellipsis
)
return
false
;
for
(
int
index
=
0
;
index
<
_encoded
.
length
;
index
+=
1
)
{
...
...
@@ -494,19 +482,18 @@ class ParagraphStyle {
return
true
;
}
int
get
hashCode
=>
hashValues
(
hashList
(
_encoded
),
_lineHeight
,
_
maxLines
,
_
ellipsis
);
int
get
hashCode
=>
hashValues
(
hashList
(
_encoded
),
_lineHeight
,
_ellipsis
);
String
toString
()
{
return
'ParagraphStyle('
'textAlign:
${ _encoded[0] & 0x02 == 0x02 ? TextAlign.values[_encoded[1]] : "unspecified"}
, '
'fontWeight:
${ _encoded[0] & 0x04 == 0x04 ? FontWeight.values[_encoded[2]] : "unspecified"}
, '
'fontStyle:
${ _encoded[0] & 0x08 == 0x08 ? FontStyle.values[_encoded[3]] : "unspecified"}
, '
'
lineCount:
${
_encoded[0] & 0x10 == 0x10 ? _encoded[4] : "unspecified"}
, '
'
maxLines:
${
_encoded[0] & 0x10 == 0x10 ? _encoded[4] : "unspecified"}
, '
'fontFamily:
${ _encoded[0] & 0x20 == 0x20 ? _fontFamily : "unspecified"}
, '
'fontSize:
${ _encoded[0] & 0x40 == 0x40 ? _fontSize : "unspecified"}
, '
'lineHeight:
${ _encoded[0] & 0x80 == 0x80 ? "${_lineHeight}
x" : "unspecified"}, '
'maxLines:
${ _encoded[0] & 0x100 == 0x100 ? _maxLines : "unspecified"}
, '
'ellipsis:
${ _encoded[0] & 0x200 == 0x200 ? "\"$_ellipsis\"" : "unspecified"}
'
'ellipsis:
${ _encoded[0] & 0x100 == 0x100 ? "\"$_ellipsis\"" : "unspecified"}
'
')'
;
}
}
...
...
@@ -734,8 +721,8 @@ abstract class Paragraph extends NativeFieldWrapperClass2 {
class
ParagraphBuilder
extends
NativeFieldWrapperClass2
{
/// Creates a [ParagraphBuilder] object, which is used to create a
/// [Paragraph].
ParagraphBuilder
(
ParagraphStyle
style
)
{
_constructor
(
style
.
_encoded
,
style
.
_fontFamily
,
style
.
_fontSize
,
style
.
_lineHeight
,
style
.
_
maxLines
,
style
.
_
ellipsis
);
}
void
_constructor
(
Int32List
encoded
,
String
fontFamily
,
double
fontSize
,
double
lineHeight
,
int
maxLines
,
String
ellipsis
)
native
"ParagraphBuilder_constructor"
;
ParagraphBuilder
(
ParagraphStyle
style
)
{
_constructor
(
style
.
_encoded
,
style
.
_fontFamily
,
style
.
_fontSize
,
style
.
_lineHeight
,
style
.
_ellipsis
);
}
void
_constructor
(
Int32List
encoded
,
String
fontFamily
,
double
fontSize
,
double
lineHeight
,
String
ellipsis
)
native
"ParagraphBuilder_constructor"
;
/// Applies the given style to the added text until [pop] is called.
///
...
...
lib/ui/text/paragraph_builder.cc
浏览文件 @
cd34b0ef
...
...
@@ -53,20 +53,19 @@ const int tsHeightMask = 1 << tsHeightIndex;
const
int
psTextAlignIndex
=
1
;
const
int
psFontWeightIndex
=
2
;
const
int
psFontStyleIndex
=
3
;
// index 4 reserved for LineCount
const
int
psMaxLinesIndex
=
4
;
const
int
psFontFamilyIndex
=
5
;
const
int
psFontSizeIndex
=
6
;
const
int
psLineHeightIndex
=
7
;
const
int
psMaxLinesIndex
=
8
;
const
int
psEllipsisIndex
=
9
;
const
int
psEllipsisIndex
=
8
;
const
int
psTextAlignMask
=
1
<<
psTextAlignIndex
;
const
int
psFontWeightMask
=
1
<<
psFontWeightIndex
;
const
int
psFontStyleMask
=
1
<<
psFontStyleIndex
;
const
int
psMaxLinesMask
=
1
<<
psMaxLinesIndex
;
const
int
psFontFamilyMask
=
1
<<
psFontFamilyIndex
;
const
int
psFontSizeMask
=
1
<<
psFontSizeIndex
;
const
int
psLineHeightMask
=
1
<<
psLineHeightIndex
;
const
int
psMaxLinesMask
=
1
<<
psMaxLinesIndex
;
const
int
psEllipsisMask
=
1
<<
psEllipsisIndex
;
float
getComputedSizeFromSpecifiedSize
(
float
specifiedSize
)
{
...
...
@@ -102,7 +101,6 @@ PassRefPtr<RenderStyle> decodeParagraphStyle(
const
std
::
string
&
fontFamily
,
double
fontSize
,
double
lineHeight
,
int
maxLines
,
const
std
::
string
&
ellipsis
)
{
FTL_DCHECK
(
encoded
.
num_elements
()
==
5
);
...
...
@@ -148,7 +146,7 @@ PassRefPtr<RenderStyle> decodeParagraphStyle(
style
->
setLineHeight
(
Length
(
lineHeight
*
100.0
,
Percent
));
if
(
mask
&
psMaxLinesMask
)
style
->
setMaxLines
(
maxLines
);
style
->
setMaxLines
(
encoded
[
psMaxLinesIndex
]
);
if
(
mask
&
psEllipsisMask
)
style
->
setEllipsis
(
AtomicString
::
fromUTF8
(
ellipsis
.
c_str
()));
...
...
@@ -179,7 +177,7 @@ FOR_EACH_BINDING(DART_NATIVE_CALLBACK)
void
ParagraphBuilder
::
RegisterNatives
(
tonic
::
DartLibraryNatives
*
natives
)
{
natives
->
Register
(
{{
"ParagraphBuilder_constructor"
,
ParagraphBuilder_constructor
,
7
,
true
},
{{
"ParagraphBuilder_constructor"
,
ParagraphBuilder_constructor
,
6
,
true
},
FOR_EACH_BINDING
(
DART_REGISTER_NATIVE
)});
}
...
...
@@ -188,22 +186,20 @@ ftl::RefPtr<ParagraphBuilder> ParagraphBuilder::create(
const
std
::
string
&
fontFamily
,
double
fontSize
,
double
lineHeight
,
int
maxLines
,
const
std
::
string
&
ellipsis
)
{
return
ftl
::
MakeRefCounted
<
ParagraphBuilder
>
(
encoded
,
fontFamily
,
fontSize
,
lineHeight
,
maxLines
,
ellipsis
);
encoded
,
fontFamily
,
fontSize
,
lineHeight
,
ellipsis
);
}
ParagraphBuilder
::
ParagraphBuilder
(
tonic
::
Int32List
&
encoded
,
const
std
::
string
&
fontFamily
,
double
fontSize
,
double
lineHeight
,
int
maxLines
,
const
std
::
string
&
ellipsis
)
{
createRenderView
();
RefPtr
<
RenderStyle
>
paragraphStyle
=
decodeParagraphStyle
(
m_renderView
->
style
(),
encoded
,
fontFamily
,
fontSize
,
lineHeight
,
maxLines
,
ellipsis
);
m_renderView
->
style
(),
encoded
,
fontFamily
,
fontSize
,
lineHeight
,
ellipsis
);
encoded
.
Release
();
m_renderParagraph
=
new
RenderParagraph
();
...
...
lib/ui/text/paragraph_builder.h
浏览文件 @
cd34b0ef
...
...
@@ -25,7 +25,6 @@ class ParagraphBuilder : public ftl::RefCountedThreadSafe<ParagraphBuilder>,
const
std
::
string
&
fontFamily
,
double
fontSize
,
double
lineHeight
,
int
maxLines
,
const
std
::
string
&
ellipsis
);
~
ParagraphBuilder
()
override
;
...
...
@@ -49,7 +48,6 @@ class ParagraphBuilder : public ftl::RefCountedThreadSafe<ParagraphBuilder>,
const
std
::
string
&
fontFamily
,
double
fontSize
,
double
lineHeight
,
int
maxLines
,
const
std
::
string
&
ellipsis
);
void
createRenderView
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录