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
9bc6d281
Commit
9bc6d281
authored
Mar 14, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2674 from abarth/child_view_error
Improve error handling for ChildView outside MojoShell
parents
d8b4a4a3
afacec9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
8 deletions
+30
-8
child_view.dart
packages/flutter/lib/src/rendering/child_view.dart
+30
-8
No files found.
packages/flutter/lib/src/rendering/child_view.dart
View file @
9bc6d281
...
...
@@ -19,11 +19,8 @@ import 'object.dart';
mojom
.
ViewProxy
_initViewProxy
(
)
{
int
viewHandle
=
ui
.
takeViewHandle
();
assert
(()
{
if
(
viewHandle
==
core
.
MojoHandle
.
INVALID
)
debugPrint
(
'Child view are supported only when running in Mojo shell.'
);
return
true
;
});
if
(
viewHandle
==
core
.
MojoHandle
.
INVALID
)
return
null
;
return
new
mojom
.
ViewProxy
.
fromHandle
(
new
core
.
MojoHandle
(
viewHandle
));
}
...
...
@@ -74,7 +71,7 @@ class ChildViewConnection {
assert
(
_viewOwner
!=
null
);
assert
(
_viewKey
==
null
);
_viewKey
=
_nextViewKey
++;
_view
.
addChild
(
_viewKey
,
_viewOwner
.
impl
);
_view
?
.
addChild
(
_viewKey
,
_viewOwner
.
impl
);
_viewOwner
=
null
;
}
...
...
@@ -83,7 +80,7 @@ class ChildViewConnection {
assert
(
_viewOwner
==
null
);
assert
(
_viewKey
!=
null
);
_viewOwner
=
new
mojom
.
ViewOwnerProxy
.
unbound
();
_view
.
removeChild
(
_viewKey
,
_viewOwner
);
_view
?
.
removeChild
(
_viewKey
,
_viewOwner
);
_viewKey
=
null
;
}
...
...
@@ -117,6 +114,8 @@ class ChildViewConnection {
assert
(
_attached
);
assert
(
_attachments
==
1
);
assert
(
_viewKey
!=
null
);
if
(
_view
==
null
)
return
new
Future
<
mojom
.
ViewLayoutInfo
>.
value
(
null
);
int
width
=
(
size
.
width
*
scale
).
round
();
int
height
=
(
size
.
height
*
scale
).
round
();
// TODO(abarth): Ideally we would propagate our actually constraints to be
...
...
@@ -188,9 +187,25 @@ class RenderChildView extends RenderBox {
size
=
constraints
.
biggest
;
}
TextPainter
_debugErrorMessage
;
void
performLayout
()
{
if
(
_child
!=
null
)
if
(
_child
!=
null
)
{
_child
.
_layout
(
size:
size
,
scale:
scale
).
then
(
_handleLayoutInfoChanged
);
assert
(()
{
if
(
_view
==
null
)
{
_debugErrorMessage
??=
new
TextPainter
()
..
text
=
new
TextSpan
(
text:
'Child view are supported only when running in Mojo shell.'
);
_debugErrorMessage
..
minWidth
=
size
.
width
..
maxWidth
=
size
.
width
..
minHeight
=
size
.
height
..
maxHeight
=
size
.
height
..
layout
();
}
return
true
;
});
}
}
mojom
.
ViewLayoutInfo
_layoutInfo
;
...
...
@@ -206,6 +221,13 @@ class RenderChildView extends RenderBox {
assert
(
needsCompositing
);
if
(
_layoutInfo
!=
null
)
context
.
pushChildScene
(
offset
,
scale
,
_layoutInfo
);
assert
(()
{
if
(
_view
==
null
)
{
context
.
canvas
.
drawRect
(
offset
&
size
,
new
Paint
()..
color
=
const
Color
(
0xFF0000FF
));
_debugErrorMessage
.
paint
(
context
.
canvas
,
offset
);
}
return
true
;
});
}
void
debugFillDescription
(
List
<
String
>
description
)
{
...
...
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