mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
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.
32 lines
1001 B
C++
32 lines
1001 B
C++
// 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.
|
|
|
|
#ifndef SKY_ENGINE_CORE_TEXT_PARAGRAPHSTYLE_H_
|
|
#define SKY_ENGINE_CORE_TEXT_PARAGRAPHSTYLE_H_
|
|
|
|
#include "sky/engine/core/text/TextAlign.h"
|
|
#include "sky/engine/core/text/TextBaseline.h"
|
|
#include "sky/engine/tonic/dart_wrappable.h"
|
|
#include "sky/engine/wtf/PassRefPtr.h"
|
|
#include "sky/engine/wtf/RefCounted.h"
|
|
|
|
namespace blink {
|
|
|
|
class ParagraphStyle : public RefCounted<ParagraphStyle>, public DartWrappable {
|
|
DEFINE_WRAPPERTYPEINFO();
|
|
public:
|
|
static PassRefPtr<ParagraphStyle> create(int align = 0, double lineHeight = 0.0, int textBaseline = 0) {
|
|
return adoptRef(new ParagraphStyle(align, lineHeight, textBaseline));
|
|
}
|
|
|
|
~ParagraphStyle() override;
|
|
|
|
private:
|
|
explicit ParagraphStyle(int align, double lineHeight, int textBaseline);
|
|
};
|
|
|
|
} // namespace blink
|
|
|
|
#endif // SKY_ENGINE_CORE_TEXT_PARAGRAPHSTYLE_H_
|