12 Commits

Author SHA1 Message Date
Adam Barth
21d7575716 Add Paragraph#getPositionForOffset
We'll use this function to position the caret when the user taps a text
input control.

Very little of the code in this patch is actually new. Most of it is
restoring code that we previously removed from the engine. I've made
some small changes to the restored code to handle the lack of a DOM. The
only major change is to RenderObject::createPositionWithAffinity, which
now just returns the values it captures instead of trying to compute a
DOM position.

TextAffinity and TextPosition are lifted from package:flutter. Once this
patch rolls into package:flutter, I'll remove the declarations there.
2016-01-29 23:07:51 -08:00
Adam Barth
88add25212 Add the TextDirection to getRectsForRange
We need this in order to draw the cursor correctly.

Fixes #1491
2016-01-29 21:12:45 -08:00
Adam Barth
153c93e8db Introduce TextBox
TextBox is a rect that understands TextDirection.
2016-01-29 12:05:16 -08:00
Adam Barth
9b6698f162 Add getRectsForRange to Paragraph
We can use getRectsForRange to implement selection painting in the
framework.
2016-01-29 01:39:47 -08:00
Jason Simmons
10ce8a1928 Move the JNI bridge out of dart:ui and into a separate dart:jni library
This also extends DartClassLibrary to support multiple DartClassProviders
for different libraries
2016-01-08 11:04:22 -08:00
Adam Barth
bd3a181dac Remove IDL from engine/core/text
Instead, use our new template magic.
2015-12-25 20:31:51 -08:00
Adam Barth
15a638332c Text snaps to pixel grid, images don't
Previously, we tried to use the render tree's paint offset to move the text to
the proper position, but that appears to snap to integer logical pixels,
introducing jitter. Now we use the SkCanvas's matrix to position the text,
removing the jitter.

Fixes https://github.com/flutter/flutter/issues/234
2015-11-20 12:49:01 -08:00
Adam Barth
1a5465c570 Delete OldTextPainter
Also, delete all references to DOM APIs.
2015-10-23 12:07:55 -07:00
Adam Barth
eb594bffdc 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.
2015-10-23 08:41:23 -07:00
Adam Barth
77264d3e94 Teach sky.Paragraph how to actually compute layout
Previously layout was exiting early because the frame view
was null. Now we actually compute some layout and paint the
text. This patch makes paragraph_builder_test pass.
2015-09-17 09:37:30 -07:00
Adam Barth
29ab28d922 ParagraphBuilder should be able to build a paragraph
This patch start down the road of implementing text layout and painting without
the DOM. We can construct a basic paragraph consisting of a single run of text
and we can get through layout without crashing.
2015-09-11 10:23:15 -07:00
Adam Barth
68b06c8736 Sketch a DOM-free API for laying out and painting text
Rather than using the DOM to upload text and styling information into the
engine, this patch begins sketching a more direct API that bypasses the DOM and
CSS. Currently, this API doesn't do anything, but it's a first step.

The approach is to have a ParagraphBuilder object that can record a tree of
style interior nodes and text leaves. The build() function then applies
container-level styling information (such as TextAlign) and returns a Paragraph
object that can undergo layout and paint.

The inputs to the builder process are immutable style objects constructed from
primitive values. These primitives are currently carbon-copies of the primitive
we use in the framework today. After this patch lands, I'll convert the frame
to re-expose these values instead of re-defining them.
2015-09-02 01:28:54 -07:00