Make NewTextPainter actually work

The NewTextPainter is still disabled by default. A future patch will flip the
flag to enable it.

This patch uses a new approach to writing bindings by encoding data into array
buffers. This approach is more efficient than the existing IDL based approach.
If this works out well, we should convert our other performance-sensitive
interfaces to this approach in future patches.
This commit is contained in:
Adam Barth
2015-10-22 22:56:56 -07:00
parent eda3a18c31
commit 5ba7a1c7ad
2 changed files with 22 additions and 3 deletions

View File

@@ -309,7 +309,7 @@ class _NewTextPainter implements TextPainter {
_text = value;
ui.ParagraphBuilder builder = new ui.ParagraphBuilder();
_text.build(builder);
_paragraph = builder.build(_text.paragraphStyle);
_paragraph = builder.build(_text.paragraphStyle ?? new ui.ParagraphStyle());
_needsLayout = true;
}

View File

@@ -151,8 +151,27 @@ class TextStyle {
return toCSS[decorationStyle];
}
ui.TextStyle get textStyle => null;
ui.ParagraphStyle get paragraphStyle => null;
ui.TextStyle get textStyle {
return new ui.TextStyle(
color: color,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontWeight: fontWeight,
fontStyle: fontStyle,
fontFamily: fontFamily,
fontSize: fontSize
);
}
ui.ParagraphStyle get paragraphStyle {
return new ui.ParagraphStyle(
// TODO(abarth): Restore once the analyzer can see the new dart:ui interface.
// textAlign: textAlign,
textBaseline: textBaseline,
lineHeight: height
);
}
/// Program this text style into the engine
///