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

23 lines
895 B
Plaintext

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
interface Paragraph {
// Inputs to layout
attribute double minWidth;
attribute double maxWidth;
attribute double minHeight;
attribute double maxHeight;
// Outputs from layout
readonly attribute double width;
readonly attribute double height;
readonly attribute double minIntrinsicWidth; // Intrinsic width if all wrappable points wrap.
readonly attribute double maxIntrinsicWidth; // Intrinsic width if no wrappable points wrap.
readonly attribute double alphabeticBaseline; // Distance from top to alphabetic baseline of first line
readonly attribute double ideographicBaseline; // Distance from top to ideographic baseline of first line
void layout();
void paint(Canvas canvas, Offset offset);
};