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

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

Issue 1210653002: Minor optimisations and cleanup to the text rendering stuff. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/rendering/paragraph.dart
diff --git a/sky/sdk/lib/rendering/paragraph.dart b/sky/sdk/lib/rendering/paragraph.dart
index 98f612582de54be58509ef1ceb98b823befc4f78..600882c40832c7795035d6a8f0b26ae900602fe0 100644
--- a/sky/sdk/lib/rendering/paragraph.dart
+++ b/sky/sdk/lib/rendering/paragraph.dart
@@ -103,19 +103,23 @@ class RenderParagraph extends RenderBox {
final sky.Document _document = new sky.Document();
final sky.LayoutRoot _layoutRoot = new sky.LayoutRoot();
- InlineBase _inline;
- BoxConstraints _constraintsForCurrentLayout;
+ BoxConstraints _constraintsForCurrentLayout; // when null, we don't have a current layout
+ InlineBase _inline;
InlineBase get inline => _inline;
void set inline (InlineBase value) {
if (_inline == value)
return;
_inline = value;
_layoutRoot.rootElement.setChild(_inline._toDOM(_document));
+ _constraintsForCurrentLayout = null;
markNeedsLayout();
}
void _layout(BoxConstraints constraints) {
+ assert(constraints != null);
+ if (_constraintsForCurrentLayout == constraints)
+ return; // already cached this layout
_layoutRoot.maxWidth = constraints.maxWidth;
_layoutRoot.minWidth = constraints.minWidth;
_layoutRoot.minHeight = constraints.minHeight;
@@ -166,9 +170,7 @@ class RenderParagraph extends RenderBox {
//
// TODO(abarth): Make computing the min/max intrinsic width/height a
// non-destructive operation.
- if (_constraintsForCurrentLayout != constraints && constraints != null)
- _layout(constraints);
-
+ _layout(constraints);
_layoutRoot.paint(canvas);
}
« 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