Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
bd3a181d
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
bd3a181d
编写于
12月 25, 2015
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove IDL from engine/core/text
Instead, use our new template magic.
上级
f018291f
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
107 addition
and
60 deletion
+107
-60
sky/engine/bindings/dart_ui.cc
sky/engine/bindings/dart_ui.cc
+5
-1
sky/engine/core/core.gni
sky/engine/core/core.gni
+0
-2
sky/engine/core/dart/text.dart
sky/engine/core/dart/text.dart
+32
-7
sky/engine/core/text/Paragraph.cpp
sky/engine/core/text/Paragraph.cpp
+26
-0
sky/engine/core/text/Paragraph.h
sky/engine/core/text/Paragraph.h
+11
-8
sky/engine/core/text/Paragraph.idl
sky/engine/core/text/Paragraph.idl
+0
-22
sky/engine/core/text/ParagraphBuilder.cpp
sky/engine/core/text/ParagraphBuilder.cpp
+25
-0
sky/engine/core/text/ParagraphBuilder.h
sky/engine/core/text/ParagraphBuilder.h
+3
-0
sky/engine/core/text/ParagraphBuilder.idl
sky/engine/core/text/ParagraphBuilder.idl
+0
-15
sky/engine/tonic/dart_args.h
sky/engine/tonic/dart_args.h
+5
-5
未找到文件。
sky/engine/bindings/dart_ui.cc
浏览文件 @
bd3a181d
...
...
@@ -9,6 +9,8 @@
#include "sky/engine/core/compositing/Scene.h"
#include "sky/engine/core/compositing/SceneBuilder.h"
#include "sky/engine/core/painting/painting.h"
#include "sky/engine/core/text/Paragraph.h"
#include "sky/engine/core/text/ParagraphBuilder.h"
#include "sky/engine/core/window/window.h"
#include "sky/engine/tonic/dart_converter.h"
#include "sky/engine/tonic/dart_error.h"
...
...
@@ -40,10 +42,12 @@ void DartUI::InitForIsolate() {
if
(
!
g_natives
)
{
g_natives
=
new
DartLibraryNatives
();
DartRuntimeHooks
::
RegisterNatives
(
g_natives
);
Window
::
RegisterNatives
(
g_natives
);
Painting
::
RegisterNatives
(
g_natives
);
Paragraph
::
RegisterNatives
(
g_natives
);
ParagraphBuilder
::
RegisterNatives
(
g_natives
);
Scene
::
RegisterNatives
(
g_natives
);
SceneBuilder
::
RegisterNatives
(
g_natives
);
Window
::
RegisterNatives
(
g_natives
);
}
DART_CHECK_VALID
(
Dart_SetNativeResolver
(
...
...
sky/engine/core/core.gni
浏览文件 @
bd3a181d
...
...
@@ -250,8 +250,6 @@ core_idl_files = get_path_info([
"painting/Picture.idl",
"painting/PictureRecorder.idl",
"painting/Shader.idl",
"text/Paragraph.idl",
"text/ParagraphBuilder.idl",
],
"abspath")
...
...
sky/engine/core/dart/text.dart
浏览文件 @
bd3a181d
...
...
@@ -309,16 +309,41 @@ class ParagraphStyle {
final
double
_lineHeight
;
}
class
ParagraphBuilder
extends
_ParagraphBuilder
{
abstract
class
Paragraph
extends
NativeFieldWrapperClass2
{
double
get
minWidth
native
"Paragraph_minWidth"
;
void
set
minWidth
(
double
value
)
native
"Paragraph_setMinWidth"
;
double
get
maxWidth
native
"Paragraph_maxWidth"
;
void
set
maxWidth
(
double
value
)
native
"Paragraph_setMaxWidth"
;
double
get
minHeight
native
"Paragraph_minHeight"
;
void
set
minHeight
(
double
value
)
native
"Paragraph_setMinHeight"
;
double
get
maxHeight
native
"Paragraph_maxHeight"
;
void
set
maxHeight
(
double
value
)
native
"Paragraph_setMaxHeight"
;
double
get
width
native
"Paragraph_width"
;
double
get
height
native
"Paragraph_height"
;
double
get
minIntrinsicWidth
native
"Paragraph_minIntrinsicWidth"
;
double
get
maxIntrinsicWidth
native
"Paragraph_maxIntrinsicWidth"
;
double
get
alphabeticBaseline
native
"Paragraph_alphabeticBaseline"
;
double
get
ideographicBaseline
native
"Paragraph_ideographicBaseline"
;
void
layout
()
native
"Paragraph_layout"
;
void
paint
(
Canvas
canvas
,
Offset
offset
)
native
"Paragraph_paint"
;
}
class
ParagraphBuilder
extends
NativeFieldWrapperClass2
{
void
_constructor
()
native
"ParagraphBuilder_constructor"
;
ParagraphBuilder
()
{
_constructor
();
}
void
_pushStyle
(
Int32List
encoded
,
String
fontFamily
,
double
fontSize
,
double
letterSpacing
)
native
"ParagraphBuilder_pushStyle"
;
void
pushStyle
(
TextStyle
style
)
{
_pushStyle
(
style
.
_encoded
,
style
.
_fontFamily
,
style
.
_fontSize
,
style
.
_letterSpacing
);
}
void
pop
()
=>
_pop
()
;
void
addText
(
String
text
)
=>
_addText
(
text
)
;
void
pop
()
native
"ParagraphBuilder_pop"
;
void
addText
(
String
text
)
native
"ParagraphBuilder_addText"
;
Paragraph
build
(
ParagraphStyle
style
)
{
Paragraph
result
=
_build
(
style
.
_encoded
,
style
.
_lineHeight
);
return
result
;
}
Paragraph
_build
(
Int32List
encoded
,
double
lineHeight
)
native
"ParagraphBuilder_build"
;
Paragraph
build
(
ParagraphStyle
style
)
=>
_build
(
style
.
_encoded
,
style
.
_lineHeight
);
}
sky/engine/core/text/Paragraph.cpp
浏览文件 @
bd3a181d
...
...
@@ -8,9 +8,35 @@
#include "sky/engine/core/rendering/style/RenderStyle.h"
#include "sky/engine/platform/fonts/FontCache.h"
#include "sky/engine/platform/graphics/GraphicsContext.h"
#include "sky/engine/tonic/dart_args.h"
#include "sky/engine/tonic/dart_binding_macros.h"
#include "sky/engine/tonic/dart_converter.h"
#include "sky/engine/tonic/dart_library_natives.h"
namespace
blink
{
IMPLEMENT_WRAPPERTYPEINFO
(
Paragraph
);
#define FOR_EACH_BINDING(V) \
V(Paragraph, minWidth) \
V(Paragraph, setMinWidth) \
V(Paragraph, maxWidth) \
V(Paragraph, setMaxWidth) \
V(Paragraph, minHeight) \
V(Paragraph, setMinHeight) \
V(Paragraph, maxHeight) \
V(Paragraph, setMaxHeight) \
V(Paragraph, width) \
V(Paragraph, height) \
V(Paragraph, minIntrinsicWidth) \
V(Paragraph, maxIntrinsicWidth) \
V(Paragraph, alphabeticBaseline) \
V(Paragraph, ideographicBaseline) \
V(Paragraph, layout) \
V(Paragraph, paint)
DART_BIND_ALL
(
Paragraph
,
FOR_EACH_BINDING
)
Paragraph
::
Paragraph
(
PassOwnPtr
<
RenderView
>
renderView
)
:
m_renderView
(
renderView
)
{
...
...
sky/engine/core/text/Paragraph.h
浏览文件 @
bd3a181d
...
...
@@ -13,6 +13,7 @@
#include "sky/engine/core/rendering/RenderView.h"
namespace
blink
{
class
DartLibraryNatives
;
class
Paragraph
:
public
RefCounted
<
Paragraph
>
,
public
DartWrappable
{
DEFINE_WRAPPERTYPEINFO
();
...
...
@@ -23,17 +24,17 @@ public:
~
Paragraph
()
override
;
LayoutUnit
minWidth
()
const
{
return
m_minWidth
;
}
void
setMinWidth
(
LayoutUnit
width
)
{
m_minWidth
=
width
;
}
double
minWidth
()
{
return
m_minWidth
;
}
void
setMinWidth
(
double
width
)
{
m_minWidth
=
width
;
}
LayoutUnit
maxWidth
()
const
{
return
m_maxWidth
;
}
void
setMaxWidth
(
LayoutUnit
width
)
{
m_maxWidth
=
width
;
}
double
maxWidth
()
{
return
m_maxWidth
;
}
void
setMaxWidth
(
double
width
)
{
m_maxWidth
=
width
;
}
LayoutUnit
minHeight
()
const
{
return
m_minHeight
;
}
void
setMinHeight
(
LayoutUnit
height
)
{
m_minHeight
=
height
;
}
double
minHeight
()
{
return
m_minHeight
;
}
void
setMinHeight
(
double
height
)
{
m_minHeight
=
height
;
}
LayoutUnit
maxHeight
()
const
{
return
m_maxHeight
;
}
void
setMaxHeight
(
LayoutUnit
height
)
{
m_maxHeight
=
height
;
}
double
maxHeight
()
{
return
m_maxHeight
;
}
void
setMaxHeight
(
double
height
)
{
m_maxHeight
=
height
;
}
double
width
();
double
height
();
...
...
@@ -47,6 +48,8 @@ public:
RenderView
*
renderView
()
const
{
return
m_renderView
.
get
();
}
static
void
RegisterNatives
(
DartLibraryNatives
*
natives
);
private:
RenderBox
*
firstChildBox
()
const
{
return
m_renderView
->
firstChildBox
();
}
...
...
sky/engine/core/text/Paragraph.idl
已删除
100644 → 0
浏览文件 @
f018291f
//
Copyright
2015
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
.
interface
Paragraph
{
//
Inputs
to
layout
attribute
double
minWidth
;
attribute
double
maxWidth
;
attribute
double
minHeight
;
attribute
double
maxHeight
;
//
Outputs
from
layout
readonly
attribute
double
width
;
readonly
attribute
double
height
;
readonly
attribute
double
minIntrinsicWidth
; // Intrinsic width if all wrappable points wrap.
readonly
attribute
double
maxIntrinsicWidth
; // Intrinsic width if no wrappable points wrap.
readonly
attribute
double
alphabeticBaseline
; // Distance from top to alphabetic baseline of first line
readonly
attribute
double
ideographicBaseline
; // Distance from top to ideographic baseline of first line
void
layout
()
;
void
paint
(
Canvas
canvas
,
Offset
offset
)
;
}
;
sky/engine/core/text/ParagraphBuilder.cpp
浏览文件 @
bd3a181d
...
...
@@ -9,6 +9,10 @@
#include "sky/engine/core/rendering/RenderParagraph.h"
#include "sky/engine/core/rendering/RenderText.h"
#include "sky/engine/core/rendering/style/RenderStyle.h"
#include "sky/engine/tonic/dart_args.h"
#include "sky/engine/tonic/dart_binding_macros.h"
#include "sky/engine/tonic/dart_converter.h"
#include "sky/engine/tonic/dart_library_natives.h"
namespace
blink
{
namespace
{
...
...
@@ -67,6 +71,27 @@ const int kLineHeightMask = 1 << kLineHeightIndex;
}
// namespace
static
void
ParagraphBuilder_constructor
(
Dart_NativeArguments
args
)
{
DartCallConstructor
(
&
ParagraphBuilder
::
create
,
args
);
}
IMPLEMENT_WRAPPERTYPEINFO
(
ParagraphBuilder
);
#define FOR_EACH_BINDING(V) \
V(ParagraphBuilder, pushStyle) \
V(ParagraphBuilder, pop) \
V(ParagraphBuilder, addText) \
V(ParagraphBuilder, build)
FOR_EACH_BINDING
(
DART_NATIVE_CALLBACK
)
void
ParagraphBuilder
::
RegisterNatives
(
DartLibraryNatives
*
natives
)
{
natives
->
Register
({
{
"ParagraphBuilder_constructor"
,
ParagraphBuilder_constructor
,
1
,
true
},
FOR_EACH_BINDING
(
DART_REGISTER_NATIVE
)
});
}
ParagraphBuilder
::
ParagraphBuilder
()
{
m_fontSelector
=
CSSFontSelector
::
create
();
...
...
sky/engine/core/text/ParagraphBuilder.h
浏览文件 @
bd3a181d
...
...
@@ -14,6 +14,7 @@
#include "sky/engine/wtf/RefCounted.h"
namespace
blink
{
class
DartLibraryNatives
;
class
ParagraphBuilder
:
public
RefCounted
<
ParagraphBuilder
>
,
public
DartWrappable
{
DEFINE_WRAPPERTYPEINFO
();
...
...
@@ -31,6 +32,8 @@ public:
PassRefPtr
<
Paragraph
>
build
(
Int32List
&
encoded
,
double
lineHeight
);
static
void
RegisterNatives
(
DartLibraryNatives
*
natives
);
private:
explicit
ParagraphBuilder
();
...
...
sky/engine/core/text/ParagraphBuilder.idl
已删除
100644 → 0
浏览文件 @
f018291f
//
Copyright
2015
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
.
[
Constructor
(),
PrivateDart
,
]
interface
ParagraphBuilder
{
void
pushStyle
(
Int32List
encoded
,
DOMString
fontFamily
,
double
fontSize
,
double
letterSpacing
)
;
void
pop
()
;
void
addText
(
DOMString
text
)
;
Paragraph
build
(
Int32List
encoded
,
double
lineHeight
)
;
}
;
sky/engine/tonic/dart_args.h
浏览文件 @
bd3a181d
...
...
@@ -90,6 +90,11 @@ struct DartArgHolder {
:
value
(
it
->
GetNext
<
ValueType
>
())
{}
};
template
<
typename
T
>
void
DartReturn
(
T
result
,
Dart_NativeArguments
args
)
{
DartConverter
<
T
>::
SetReturnValue
(
args
,
result
);
}
template
<
typename
IndicesType
,
typename
T
>
class
DartDispatcher
{
};
...
...
@@ -149,11 +154,6 @@ struct DartDispatcher<IndicesHolder<indices...>, ResultType (C::*)(ArgTypes...)>
}
};
template
<
typename
T
>
void
DartReturn
(
T
result
,
Dart_NativeArguments
args
)
{
DartConverter
<
T
>::
SetReturnValue
(
args
,
result
);
}
template
<
typename
Sig
>
void
DartCall
(
Sig
func
,
Dart_NativeArguments
args
)
{
DartArgIterator
it
(
args
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录