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

Unified Diff: sky/sdk/lib/rendering/box.dart

Issue 1235713002: Support getting baseline from paint as well as layout. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/sdk/lib/rendering/object.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/rendering/box.dart
diff --git a/sky/sdk/lib/rendering/box.dart b/sky/sdk/lib/rendering/box.dart
index 460956bacb482e35f7f27a5266c12626bf64a0ad..e2a1a4e1b36b5a7272387f41017377c3495e8408 100644
--- a/sky/sdk/lib/rendering/box.dart
+++ b/sky/sdk/lib/rendering/box.dart
@@ -306,15 +306,20 @@ abstract class RenderBox extends RenderObject {
// y-coordinate of the position of the box to the y-coordinate of
// the bottom of the box, i.e., the height of the box. Only call
// this after layout has been performed. You are only allowed to
- // call this from the parent of this node, and only during
- // that parent's performLayout().
+ // call this from the parent of this node during that parent's
+ // performLayout() or paint().
double getDistanceToBaseline(TextBaseline baseline) {
assert(!needsLayout);
assert(!_debugDoingBaseline);
final parent = this.parent; // TODO(ianh): Remove this once the analyzer is cleverer
assert(parent is RenderObject);
- assert(parent == RenderObject.debugActiveLayout);
- assert(parent.debugDoingThisLayout);
+ assert(() {
+ if (RenderObject.debugDoingLayout)
+ return (parent == RenderObject.debugActiveLayout) && parent.debugDoingThisLayout;
+ if (RenderObject.debugDoingPaint)
+ return (parent == RenderObject.debugActivePaint) && parent.debugDoingThisPaint;
+ return false;
+ });
assert(_debugSetDoingBaseline(true));
double result = getDistanceToActualBaseline(baseline);
assert(_debugSetDoingBaseline(false));
« no previous file with comments | « no previous file | sky/sdk/lib/rendering/object.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698