Make Paragraph methods really return List<int> if they are declared as such. (flutter/engine#4676)

Changed methods _getPositionForOffset and getWordBoundary to use
Dart_NewListOf(Dart_CoreType_Int, ...).
This commit is contained in:
Vyacheslav Egorov 2018-02-14 19:07:05 +01:00 committed by GitHub
parent 10b44c539f
commit 553bb9da9d
2 changed files with 4 additions and 4 deletions

View File

@ -145,7 +145,7 @@ int ParagraphImplBlink::absoluteOffsetForPosition(
Dart_Handle ParagraphImplBlink::getPositionForOffset(double dx, double dy) {
LayoutPoint point(dx, dy);
PositionWithAffinity position = m_renderView->positionForPoint(point);
Dart_Handle result = Dart_NewList(2);
Dart_Handle result = Dart_NewListOf(Dart_CoreType_Int, 2);
Dart_ListSetAt(result, 0, ToDart(absoluteOffsetForPosition(position)));
Dart_ListSetAt(result, 1, ToDart(static_cast<int>(position.affinity())));
return result;
@ -171,7 +171,7 @@ Dart_Handle ParagraphImplBlink::getWordBoundary(unsigned offset) {
start = it->previous();
}
Dart_Handle result = Dart_NewList(2);
Dart_Handle result = Dart_NewListOf(Dart_CoreType_Int, 2);
Dart_ListSetAt(result, 0, ToDart(start));
Dart_ListSetAt(result, 1, ToDart(end));
return result;

View File

@ -74,7 +74,7 @@ std::vector<TextBox> ParagraphImplTxt::getRectsForRange(unsigned start,
}
Dart_Handle ParagraphImplTxt::getPositionForOffset(double dx, double dy) {
Dart_Handle result = Dart_NewList(2);
Dart_Handle result = Dart_NewListOf(Dart_CoreType_Int, 2);
txt::Paragraph::PositionWithAffinity pos =
m_paragraph->GetGlyphPositionAtCoordinate(dx, dy);
Dart_ListSetAt(result, 0, ToDart(pos.position));
@ -84,7 +84,7 @@ Dart_Handle ParagraphImplTxt::getPositionForOffset(double dx, double dy) {
Dart_Handle ParagraphImplTxt::getWordBoundary(unsigned offset) {
txt::Paragraph::Range<size_t> point = m_paragraph->GetWordBoundary(offset);
Dart_Handle result = Dart_NewList(2);
Dart_Handle result = Dart_NewListOf(Dart_CoreType_Int, 2);
Dart_ListSetAt(result, 0, ToDart(point.start));
Dart_ListSetAt(result, 1, ToDart(point.end));
return result;