Commit 5ba7a1c7 authored by Adam Barth's avatar Adam Barth

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.
parent eda3a18c
......@@ -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;
}
......
......@@ -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
///
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment