Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(831)

Side by Side Diff: sky/sdk/lib/rendering/README.md

Issue 1204373003: Fix nits in the README.md from abarth's review. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Sky Rendering 1 Sky Rendering
2 ============= 2 =============
3 3
4 The Sky render tree is a low-level layout and painting system based on a 4 The Sky render tree is a low-level layout and painting system based on a
5 retained tree of objects that inherit from [`RenderObject`](object.dart). Most 5 retained tree of objects that inherit from [`RenderObject`](object.dart). Most
6 developers using Sky will not need to interact directly with the rendering tree. 6 developers using Sky will not need to interact directly with the rendering tree.
7 Instead, most developers should use [Sky widgets](../widgets/README.md), which 7 Instead, most developers should use [Sky widgets](../widgets/README.md), which
8 are built using the render tree. 8 are built using the render tree.
9 9
10 Overview 10 Overview
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ### RenderFlex (render_flex.dart) 130 ### RenderFlex (render_flex.dart)
131 ### RenderParagraph (render_paragraph.dart) 131 ### RenderParagraph (render_paragraph.dart)
132 ### RenderStack (render_stack.dart) 132 ### RenderStack (render_stack.dart)
133 133
134 Writing new subclasses 134 Writing new subclasses
135 ---------------------- 135 ----------------------
136 136
137 ### The RenderObject contract 137 ### The RenderObject contract
138 138
139 If you want to define a `RenderObject` that uses a new coordinate 139 If you want to define a `RenderObject` that uses a new coordinate
140 system, then you have to inherit straight from `RenderObject`. 140 system, then you should inherit straight from `RenderObject`. Examples
141 Examples of doing this can be found in [`RenderBox`](box.dart), which 141 of doing this can be found in [`RenderBox`](box.dart), which deals in
142 deals in rectangles in cartesian space, and in the [sector_layout.dart 142 rectangles in cartesian space, and in the [sector_layout.dart
143 example](../../../examples/rendering/sector_layout.dart), which 143 example](../../../examples/rendering/sector_layout.dart), which
144 implements a toy model based on polar coordinates. The `RenderView` 144 implements a toy model based on polar coordinates. The `RenderView`
145 class, which is used internally to adapt from the host system to this 145 class, which is used internally to adapt from the host system to this
146 rendering framework, is another example. 146 rendering framework, is another example.
147 147
148 A subclass of `RenderObject` must fulfill the following contract: 148 A subclass of `RenderObject` must fulfill the following contract:
149 149
150 * It must fulfill the [AbstractNode contract](../base/README.md) when 150 * It must fulfill the [AbstractNode contract](../base/README.md) when
151 dealing with children. Using `RenderObjectWithChildMixin` or 151 dealing with children. Using `RenderObjectWithChildMixin` or
152 `ContainerRenderObjectMixin` can make this easier. 152 `ContainerRenderObjectMixin` can make this easier.
153 153
154 * Information about the child managed by the parent, e.g. typically 154 * Information about the child managed by the parent, e.g. typically
155 position information and configuration for the parent's layout, 155 position information and configuration for the parent's layout,
156 should be stored on the `parentData` member; to this effect, a 156 should be stored on the `parentData` member; to this effect, a
157 ParentData subclass should be defined and the `setParentData()` 157 ParentData subclass should be defined and the `setParentData()`
158 method should be overriden to initialise the child's parent data 158 method should be overriden to initialise the child's parent data
159 appropriately. 159 appropriately.
160 160
161 * Layout constraints must be expressed in a Constraints subclass. This 161 * Layout constraints must be expressed in a Constraints subclass. This
162 subclass must implement operator== (and hashCode). 162 subclass must implement `operator==` (and `hashCode`).
163 163
164 * Whenever the layout needs updating, the `markNeedsLayout()` method 164 * Whenever the layout needs updating, the `markNeedsLayout()` method
165 should be called. 165 should be called.
166 166
167 * Whenever the rendering needs updating without changing the layout, 167 * Whenever the rendering needs updating without changing the layout,
168 the `markNeedsPaint()` method should be called. (Calling 168 the `markNeedsPaint()` method should be called. (Calling
169 `markNeedsLayout()` implies a call to `markNeedsPaint()`, so you 169 `markNeedsLayout()` implies a call to `markNeedsPaint()`, so you
170 don't need to call both.) 170 don't need to call both.)
171 171
172 * The subclass must override `performLayout()` to perform layout based 172 * The subclass must override `performLayout()` to perform layout based
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 352
353 * Avoid using save/restore on canvases. 353 * Avoid using save/restore on canvases.
354 354
355 355
356 Dependencies 356 Dependencies
357 ------------ 357 ------------
358 358
359 * [`package:sky/base`](../base) 359 * [`package:sky/base`](../base)
360 * [`package:sky/mojo`](../mojo) 360 * [`package:sky/mojo`](../mojo)
361 * [`package:sky/animation`](../mojo) 361 * [`package:sky/animation`](../mojo)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698