提交 92973b37 编写于 作者: A Adam Barth 提交者: GitHub

Remove Paragraph stubs (#3002)

We can now use the real thing on Fuchsia.
上级 d7f807c9
......@@ -44,6 +44,12 @@ source_set("ui") {
"painting/rrect.h",
"painting/shader.cc",
"painting/shader.h",
"text/paragraph_builder.cc",
"text/paragraph_builder.h",
"text/paragraph.cc",
"text/paragraph.h",
"text/text_box.cc",
"text/text_box.h",
"ui_dart_state.cc",
"ui_dart_state.h",
"window/window.cc",
......@@ -67,24 +73,6 @@ source_set("ui") {
"//mojo/services/asset_bundle/interfaces",
]
if (is_fuchsia) {
sources += [
"text/paragraph_builder_stub.cc",
"text/paragraph_builder_stub.h",
"text/paragraph_stub.cc",
"text/paragraph_stub.h",
]
} else {
sources += [
"text/paragraph_builder.cc",
"text/paragraph_builder.h",
"text/paragraph.cc",
"text/paragraph.h",
"text/text_box.cc",
"text/text_box.h",
]
}
if (is_android) {
deps += [
# TODO(abarth): In principle, these libraries should be fully independent.
......
......@@ -18,19 +18,13 @@
#include "flutter/lib/ui/painting/path.h"
#include "flutter/lib/ui/painting/picture_recorder.h"
#include "flutter/lib/ui/painting/picture.h"
#include "flutter/lib/ui/text/paragraph_builder.h"
#include "flutter/lib/ui/text/paragraph.h"
#include "flutter/lib/ui/window/window.h"
#include "lib/ftl/build_config.h"
#include "lib/tonic/converter/dart_converter.h"
#include "lib/tonic/logging/dart_error.h"
#if defined(OS_FUCHSIA)
#include "flutter/lib/ui/text/paragraph_builder_stub.h"
#include "flutter/lib/ui/text/paragraph_stub.h"
#else
#include "flutter/lib/ui/text/paragraph_builder.h"
#include "flutter/lib/ui/text/paragraph.h"
#endif
using tonic::ToDart;
namespace blink {
......
// 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.
#include "flutter/lib/ui/text/paragraph_builder_stub.h"
#include "lib/tonic/converter/dart_converter.h"
#include "lib/tonic/dart_args.h"
#include "lib/tonic/dart_binding_macros.h"
#include "lib/tonic/dart_library_natives.h"
namespace blink {
static void ParagraphBuilder_constructor(Dart_NativeArguments args) {
DartCallConstructor(&ParagraphBuilder::create, args);
}
IMPLEMENT_WRAPPERTYPEINFO(ui, ParagraphBuilder);
#define FOR_EACH_BINDING(V) \
V(ParagraphBuilder, pushStyle) \
V(ParagraphBuilder, pop) \
V(ParagraphBuilder, addText) \
V(ParagraphBuilder, build)
FOR_EACH_BINDING(DART_NATIVE_CALLBACK)
void ParagraphBuilder::RegisterNatives(tonic::DartLibraryNatives* natives) {
natives->Register(
{{"ParagraphBuilder_constructor", ParagraphBuilder_constructor, 1, true},
FOR_EACH_BINDING(DART_REGISTER_NATIVE)});
}
ParagraphBuilder::ParagraphBuilder() {}
ParagraphBuilder::~ParagraphBuilder() {}
void ParagraphBuilder::pushStyle(tonic::Int32List& encoded,
const std::string& fontFamily,
double fontSize,
double letterSpacing,
double wordSpacing,
double height) {
encoded.Release();
}
void ParagraphBuilder::pop() {}
void ParagraphBuilder::addText(const std::string& text) {}
ftl::RefPtr<Paragraph> ParagraphBuilder::build(tonic::Int32List& encoded,
const std::string& fontFamily,
double fontSize,
double lineHeight) {
encoded.Release();
return Paragraph::create();
}
} // namespace blink
// 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 FLUTTER_LIB_UI_TEXT_PARAGRAPH_BUILDER_STUB_H_
#define FLUTTER_LIB_UI_TEXT_PARAGRAPH_BUILDER_STUB_H_
#include "flutter/lib/ui/text/paragraph_stub.h"
#include "lib/tonic/dart_wrappable.h"
#include "lib/tonic/typed_data/int32_list.h"
namespace tonic {
class DartLibraryNatives;
} // namespace tonic
namespace blink {
class ParagraphBuilder : public ftl::RefCountedThreadSafe<ParagraphBuilder>,
public tonic::DartWrappable {
DEFINE_WRAPPERTYPEINFO();
FRIEND_MAKE_REF_COUNTED(ParagraphBuilder);
public:
static ftl::RefPtr<ParagraphBuilder> create() {
return ftl::MakeRefCounted<ParagraphBuilder>();
}
~ParagraphBuilder() override;
void pushStyle(tonic::Int32List& encoded,
const std::string& fontFamily,
double fontSize,
double letterSpacing,
double wordSpacing,
double height);
void pop();
void addText(const std::string& text);
ftl::RefPtr<Paragraph> build(tonic::Int32List& encoded,
const std::string& fontFamily,
double fontSize,
double lineHeight);
static void RegisterNatives(tonic::DartLibraryNatives* natives);
private:
ParagraphBuilder();
};
} // namespace blink
#endif // FLUTTER_LIB_UI_TEXT_PARAGRAPH_BUILDER_STUB_H_
// 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.
#include "flutter/lib/ui/text/paragraph_stub.h"
#include "lib/tonic/converter/dart_converter.h"
#include "lib/tonic/dart_args.h"
#include "lib/tonic/dart_binding_macros.h"
#include "lib/tonic/dart_library_natives.h"
using tonic::ToDart;
namespace blink {
IMPLEMENT_WRAPPERTYPEINFO(ui, Paragraph);
#define FOR_EACH_BINDING(V) \
V(Paragraph, width) \
V(Paragraph, height) \
V(Paragraph, minIntrinsicWidth) \
V(Paragraph, maxIntrinsicWidth) \
V(Paragraph, alphabeticBaseline) \
V(Paragraph, ideographicBaseline) \
V(Paragraph, layout) \
V(Paragraph, paint) \
V(Paragraph, getWordBoundary) \
V(Paragraph, getRectsForRange) \
V(Paragraph, getPositionForOffset)
DART_BIND_ALL(Paragraph, FOR_EACH_BINDING)
Paragraph::Paragraph() {}
Paragraph::~Paragraph() {}
double Paragraph::width() {
return 0.0;
}
double Paragraph::height() {
return 0.0;
}
double Paragraph::minIntrinsicWidth() {
return 0.0;
}
double Paragraph::maxIntrinsicWidth() {
return 0.0;
}
double Paragraph::alphabeticBaseline() {
return 0.0;
}
double Paragraph::ideographicBaseline() {
return 0.0;
}
void Paragraph::layout(double width) {}
void Paragraph::paint(Canvas* canvas, double x, double y) {}
void Paragraph::getRectsForRange(unsigned start, unsigned end) {}
Dart_Handle Paragraph::getPositionForOffset(double dx, double dy) {
Dart_Handle result = Dart_NewList(2);
Dart_ListSetAt(result, 0, ToDart(0));
Dart_ListSetAt(result, 1, ToDart(0));
return result;
}
Dart_Handle Paragraph::getWordBoundary(unsigned offset) {
Dart_Handle result = Dart_NewList(2);
Dart_ListSetAt(result, 0, ToDart(0));
Dart_ListSetAt(result, 1, ToDart(0));
return result;
}
} // namespace blink
// 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 FLUTTER_LIB_UI_TEXT_PARAGRAPH_STUB_H_
#define FLUTTER_LIB_UI_TEXT_PARAGRAPH_STUB_H_
#include "flutter/lib/ui/painting/canvas.h"
#include "lib/tonic/dart_wrappable.h"
namespace tonic {
class DartLibraryNatives;
} // namespace tonic
namespace blink {
class Paragraph : public ftl::RefCountedThreadSafe<Paragraph>,
public tonic::DartWrappable {
DEFINE_WRAPPERTYPEINFO();
FRIEND_MAKE_REF_COUNTED(Paragraph);
public:
static ftl::RefPtr<Paragraph> create() {
return ftl::MakeRefCounted<Paragraph>();
}
~Paragraph() override;
double width();
double height();
double minIntrinsicWidth();
double maxIntrinsicWidth();
double alphabeticBaseline();
double ideographicBaseline();
void layout(double width);
void paint(Canvas* canvas, double x, double y);
void getRectsForRange(unsigned start, unsigned end);
Dart_Handle getPositionForOffset(double dx, double dy);
Dart_Handle getWordBoundary(unsigned offset);
static void RegisterNatives(tonic::DartLibraryNatives* natives);
private:
Paragraph();
};
} // namespace blink
#endif // FLUTTER_LIB_UI_TEXT_PARAGRAPH_STUB_H_
......@@ -6,16 +6,13 @@
#include "flutter/lib/ui/mojo_services.h"
#include "flutter/lib/ui/window/window.h"
#include "flutter/sky/engine/platform/fonts/FontSelector.h"
#include "lib/tonic/converter/dart_converter.h"
#if defined(OS_ANDROID)
#include "flutter/lib/jni/dart_jni.h"
#endif
#if !defined(OS_FUCHSIA)
#include "flutter/sky/engine/platform/fonts/FontSelector.h"
#endif
using tonic::ToDart;
namespace blink {
......@@ -73,8 +70,6 @@ DartJniIsolateData* UIDartState::jni_data() {
}
#endif // defined(OS_ANDROID)
#if !defined(OS_FUCHSIA)
void UIDartState::set_font_selector(PassRefPtr<FontSelector> selector) {
font_selector_ = selector;
}
......@@ -83,6 +78,4 @@ PassRefPtr<FontSelector> UIDartState::font_selector() {
return font_selector_;
}
#endif // !defined(OS_FUCHSIA)
} // namespace blink
......@@ -6,14 +6,11 @@
#define FLUTTER_LIB_UI_UI_DART_STATE_H_
#include "dart/runtime/include/dart_api.h"
#include "flutter/sky/engine/wtf/RefPtr.h"
#include "lib/ftl/build_config.h"
#include "lib/tonic/dart_persistent_value.h"
#include "lib/tonic/dart_state.h"
#if !defined(OS_FUCHSIA)
#include "flutter/sky/engine/wtf/RefPtr.h"
#endif
namespace blink {
class FontSelector;
class DartJniIsolateData;
......@@ -49,10 +46,8 @@ class UIDartState : public tonic::DartState {
DartJniIsolateData* jni_data();
#endif
#if !defined(OS_FUCHSIA)
void set_font_selector(PassRefPtr<FontSelector> selector);
PassRefPtr<FontSelector> font_selector();
#endif
private:
void DidSetIsolate() override;
......@@ -62,14 +57,11 @@ class UIDartState : public tonic::DartState {
std::string debug_name_;
std::unique_ptr<MojoServices> mojo_services_;
std::unique_ptr<Window> window_;
RefPtr<FontSelector> font_selector_;
#if defined(OS_ANDROID)
std::unique_ptr<DartJniIsolateData> jni_data_;
#endif
#if !defined(OS_FUCHSIA)
RefPtr<FontSelector> font_selector_;
#endif
};
} // namespace blink
......
......@@ -35,6 +35,10 @@ config("non_test_config") {
}
group("engine") {
public_configs = [
":config",
]
public_deps = [
"//flutter/sky/engine/core",
"//flutter/sky/engine/platform",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册