Skip to content

Commit

Permalink
Make Paragraph methods really return List<int> if they are declared a…
Browse files Browse the repository at this point in the history
…s such. (flutter#4676)

Changed methods _getPositionForOffset and getWordBoundary to use
Dart_NewListOf(Dart_CoreType_Int, ...).
  • Loading branch information
mraleph authored Feb 14, 2018
1 parent 468935e commit 03a5983
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/ui/text/paragraph_impl_blink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/text/paragraph_impl_txt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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;
Expand Down

0 comments on commit 03a5983

Please sign in to comment.