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
dfc7f00a
Commit
dfc7f00a
authored
Oct 09, 2015
by
Hixie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove workarounds that avoided 'super' in mixins
Dart supports this properly now.
parent
57cc25a3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
32 deletions
+30
-32
box.dart
packages/flutter/lib/src/rendering/box.dart
+2
-1
node.dart
packages/flutter/lib/src/rendering/node.dart
+4
-16
object.dart
packages/flutter/lib/src/rendering/object.dart
+24
-15
No files found.
packages/flutter/lib/src/rendering/box.dart
View file @
dfc7f00a
...
...
@@ -631,7 +631,8 @@ abstract class RenderBox extends RenderObject {
String
debugDescribeSettings
(
String
prefix
)
=>
'
${super.debugDescribeSettings(prefix)}${prefix}
size:
${size}
\n
'
;
}
/// A mixin that provides useful default behaviors for boxes with children managed by the [ContainerRenderObjectMixin] mixin
/// A mixin that provides useful default behaviors for boxes with children
/// managed by the [ContainerRenderObjectMixin] mixin.
///
/// By convention, this class doesn't override any members of the superclass.
/// Instead, it provides helpful functions that subclasses can call as
...
...
packages/flutter/lib/src/rendering/node.dart
View file @
dfc7f00a
...
...
@@ -68,32 +68,20 @@ class AbstractNode {
/// Mark this node as attached.
///
/// Typically called only from
overrides of [attachChildren] and to mark the
///
root of
a tree attached.
/// Typically called only from
the parent's attach(), and to mark the root of
/// a tree attached.
void
attach
()
{
_attached
=
true
;
attachChildren
();
}
/// Override this function in subclasses with child to call attach() for each
/// child. Do not call directly.
attachChildren
()
{
}
/// Mark this node as detached.
///
/// Typically called only from
overrides for [detachChildren] and to mark the
///
root of
a tree detached.
/// Typically called only from
the parent's detach(), and to mark the root of
/// a tree detached.
void
detach
()
{
_attached
=
false
;
detachChildren
();
}
/// Override this function in subclasses with child to call detach() for each
/// child. Do not call directly.
detachChildren
()
{
}
// TODO(ianh): remove attachChildren()/detachChildren() workaround once mixins can use super.
AbstractNode
_parent
;
/// The parent of this node in the tree.
AbstractNode
get
parent
=>
_parent
;
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
dfc7f00a
...
...
@@ -25,15 +25,15 @@ typedef sky.Shader ShaderCallback(Rect bounds);
/// input parameters to the parent's layout algorithm or their position relative
/// to other children.
class
ParentData
{
void
detach
()
{
detachSiblings
();
}
void
detachSiblings
()
{
}
// workaround for lack of inter-class mixins in Dart
/// Called when the RenderObject is removed from the tree.
void
detach
()
{
}
/// Override this function in subclasses to merge in data from other instance into this instance
/// Override this function in subclasses to merge in data from other instance
/// into this instance.
void
merge
(
ParentData
other
)
{
assert
(
other
.
runtimeType
==
this
.
runtimeType
);
}
String
toString
()
=>
'<none>'
;
}
...
...
@@ -1158,11 +1158,13 @@ abstract class RenderObjectWithChildMixin<ChildType extends RenderObject> implem
if
(
_child
!=
null
)
adoptChild
(
_child
);
}
void
attachChildren
()
{
void
attach
()
{
super
.
attach
();
if
(
_child
!=
null
)
_child
.
attach
();
}
void
detachChildren
()
{
void
detach
()
{
super
.
detach
();
if
(
_child
!=
null
)
_child
.
detach
();
}
...
...
@@ -1178,14 +1180,15 @@ abstract class RenderObjectWithChildMixin<ChildType extends RenderObject> implem
}
/// Parent data to support a doubly-linked list of children
abstract
class
ContainerParentDataMixin
<
ChildType
extends
RenderObject
>
{
abstract
class
ContainerParentDataMixin
<
ChildType
extends
RenderObject
>
implements
ParentData
{
/// The previous sibling in the parent's child list
ChildType
previousSibling
;
/// The next sibling in the parent's child list
ChildType
nextSibling
;
/// Clear the sibling pointers.
void
detachSiblings
()
{
void
detach
()
{
super
.
detach
();
if
(
previousSibling
!=
null
)
{
assert
(
previousSibling
.
parentData
is
ContainerParentDataMixin
<
ChildType
>);
assert
(
previousSibling
!=
this
);
...
...
@@ -1362,30 +1365,36 @@ abstract class ContainerRenderObjectMixin<ChildType extends RenderObject, Parent
_removeFromChildList
(
child
);
_addToChildList
(
child
,
before:
before
);
}
void
redepthChildren
()
{
void
attach
()
{
super
.
attach
();
ChildType
child
=
_firstChild
;
while
(
child
!=
null
)
{
redepthChild
(
child
);
child
.
attach
(
);
assert
(
child
.
parentData
is
ParentDataType
);
child
=
child
.
parentData
.
nextSibling
;
}
}
void
attachChildren
()
{
void
detach
()
{
super
.
detach
();
ChildType
child
=
_firstChild
;
while
(
child
!=
null
)
{
child
.
at
tach
();
child
.
de
tach
();
assert
(
child
.
parentData
is
ParentDataType
);
child
=
child
.
parentData
.
nextSibling
;
}
}
void
detachChildren
()
{
void
redepthChildren
()
{
ChildType
child
=
_firstChild
;
while
(
child
!=
null
)
{
child
.
detach
(
);
redepthChild
(
child
);
assert
(
child
.
parentData
is
ParentDataType
);
child
=
child
.
parentData
.
nextSibling
;
}
}
void
visitChildren
(
RenderObjectVisitor
visitor
)
{
ChildType
child
=
_firstChild
;
while
(
child
!=
null
)
{
...
...
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