flutter_flutter/lib/ui/text/paragraph.h
Chinmay Garde eec74e5c92
Rename the blink namespace to flutter. (#8517)
Some components in the Flutter engine were derived from the forked blink codebase. While the forked components have either been removed or rewritten, the use of the blink namespace has mostly (and inconsistently) remained. This renames the blink namesapce to flutter for consistency. There are no functional changes in this patch.
2019-04-09 12:44:42 -07:00

65 lines
1.9 KiB
C++

// Copyright 2013 The Flutter 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 FLUTTER_LIB_UI_TEXT_PARAGRAPH_H_
#define FLUTTER_LIB_UI_TEXT_PARAGRAPH_H_
#include "flutter/fml/message_loop.h"
#include "flutter/lib/ui/dart_wrapper.h"
#include "flutter/lib/ui/painting/canvas.h"
#include "flutter/lib/ui/text/paragraph_impl.h"
#include "flutter/lib/ui/text/paragraph_impl_txt.h"
#include "flutter/lib/ui/text/text_box.h"
#include "flutter/third_party/txt/src/txt/paragraph.h"
namespace tonic {
class DartLibraryNatives;
} // namespace tonic
namespace flutter {
class Paragraph : public RefCountedDartWrappable<Paragraph> {
DEFINE_WRAPPERTYPEINFO();
FML_FRIEND_MAKE_REF_COUNTED(Paragraph);
public:
static fml::RefPtr<Paragraph> Create(
std::unique_ptr<txt::Paragraph> paragraph) {
return fml::MakeRefCounted<Paragraph>(std::move(paragraph));
}
~Paragraph() override;
double width();
double height();
double minIntrinsicWidth();
double maxIntrinsicWidth();
double alphabeticBaseline();
double ideographicBaseline();
bool didExceedMaxLines();
void layout(double width);
void paint(Canvas* canvas, double x, double y);
std::vector<TextBox> getRectsForRange(unsigned start,
unsigned end,
unsigned boxHeightStyle,
unsigned boxWidthStyle);
Dart_Handle getPositionForOffset(double dx, double dy);
Dart_Handle getWordBoundary(unsigned offset);
size_t GetAllocationSize() override;
static void RegisterNatives(tonic::DartLibraryNatives* natives);
private:
std::unique_ptr<ParagraphImpl> m_paragraphImpl;
explicit Paragraph(std::unique_ptr<txt::Paragraph> paragraph);
};
} // namespace flutter
#endif // FLUTTER_LIB_UI_TEXT_PARAGRAPH_H_