diff --git a/lib/ui/text/paragraph.cc b/lib/ui/text/paragraph.cc index fedf84e02c7de..8c4cd1f1fc35a 100644 --- a/lib/ui/text/paragraph.cc +++ b/lib/ui/text/paragraph.cc @@ -22,55 +22,55 @@ namespace flutter { IMPLEMENT_WRAPPERTYPEINFO(ui, Paragraph); Paragraph::Paragraph(std::unique_ptr paragraph) - : m_paragraph(std::move(paragraph)) {} + : m_paragraph_(std::move(paragraph)) {} Paragraph::~Paragraph() = default; double Paragraph::width() { - return m_paragraph->GetMaxWidth(); + return m_paragraph_->GetMaxWidth(); } double Paragraph::height() { - return m_paragraph->GetHeight(); + return m_paragraph_->GetHeight(); } double Paragraph::longestLine() { - return m_paragraph->GetLongestLine(); + return m_paragraph_->GetLongestLine(); } double Paragraph::minIntrinsicWidth() { - return m_paragraph->GetMinIntrinsicWidth(); + return m_paragraph_->GetMinIntrinsicWidth(); } double Paragraph::maxIntrinsicWidth() { - return m_paragraph->GetMaxIntrinsicWidth(); + return m_paragraph_->GetMaxIntrinsicWidth(); } double Paragraph::alphabeticBaseline() { - return m_paragraph->GetAlphabeticBaseline(); + return m_paragraph_->GetAlphabeticBaseline(); } double Paragraph::ideographicBaseline() { - return m_paragraph->GetIdeographicBaseline(); + return m_paragraph_->GetIdeographicBaseline(); } bool Paragraph::didExceedMaxLines() { - return m_paragraph->DidExceedMaxLines(); + return m_paragraph_->DidExceedMaxLines(); } void Paragraph::layout(double width) { - m_paragraph->Layout(width); + m_paragraph_->Layout(width); } void Paragraph::paint(Canvas* canvas, double x, double y) { - if (!m_paragraph || !canvas) { + if (!m_paragraph_ || !canvas) { // disposed. return; } DisplayListBuilder* builder = canvas->builder(); if (builder) { - m_paragraph->Paint(builder, x, y); + m_paragraph_->Paint(builder, x, y); } } @@ -98,7 +98,7 @@ tonic::Float32List Paragraph::getRectsForRange(unsigned start, unsigned end, unsigned boxHeightStyle, unsigned boxWidthStyle) { - std::vector boxes = m_paragraph->GetRectsForRange( + std::vector boxes = m_paragraph_->GetRectsForRange( start, end, static_cast(boxHeightStyle), static_cast(boxWidthStyle)); return EncodeTextBoxes(boxes); @@ -106,13 +106,13 @@ tonic::Float32List Paragraph::getRectsForRange(unsigned start, tonic::Float32List Paragraph::getRectsForPlaceholders() { std::vector boxes = - m_paragraph->GetRectsForPlaceholders(); + m_paragraph_->GetRectsForPlaceholders(); return EncodeTextBoxes(boxes); } Dart_Handle Paragraph::getPositionForOffset(double dx, double dy) { txt::Paragraph::PositionWithAffinity pos = - m_paragraph->GetGlyphPositionAtCoordinate(dx, dy); + m_paragraph_->GetGlyphPositionAtCoordinate(dx, dy); std::vector result = { pos.position, // size_t already static_cast(pos.affinity) // affinity (enum) @@ -121,13 +121,13 @@ Dart_Handle Paragraph::getPositionForOffset(double dx, double dy) { } Dart_Handle Paragraph::getWordBoundary(unsigned offset) { - txt::Paragraph::Range point = m_paragraph->GetWordBoundary(offset); + txt::Paragraph::Range point = m_paragraph_->GetWordBoundary(offset); std::vector result = {point.start, point.end}; return tonic::DartConverter::ToDart(result); } Dart_Handle Paragraph::getLineBoundary(unsigned utf16Offset) { - std::vector metrics = m_paragraph->GetLineMetrics(); + std::vector metrics = m_paragraph_->GetLineMetrics(); int line_start = -1; int line_end = -1; for (txt::LineMetrics& line : metrics) { @@ -142,7 +142,7 @@ Dart_Handle Paragraph::getLineBoundary(unsigned utf16Offset) { } tonic::Float64List Paragraph::computeLineMetrics() const { - std::vector metrics = m_paragraph->GetLineMetrics(); + std::vector metrics = m_paragraph_->GetLineMetrics(); // Layout: // boxes.size() groups of 9 which are the line metrics @@ -172,7 +172,7 @@ tonic::Float64List Paragraph::computeLineMetrics() const { Dart_Handle Paragraph::getLineMetricsAt(int lineNumber, Dart_Handle constructor) const { skia::textlayout::LineMetrics line; - const bool found = m_paragraph->GetLineMetricsAt(lineNumber, &line); + const bool found = m_paragraph_->GetLineMetricsAt(lineNumber, &line); if (!found) { return Dart_Null(); } @@ -198,15 +198,15 @@ Dart_Handle Paragraph::getLineMetricsAt(int lineNumber, } size_t Paragraph::getNumberOfLines() const { - return m_paragraph->GetNumberOfLines(); + return m_paragraph_->GetNumberOfLines(); } int Paragraph::getLineNumberAt(size_t utf16Offset) const { - return m_paragraph->GetLineNumberAt(utf16Offset); + return m_paragraph_->GetLineNumberAt(utf16Offset); } void Paragraph::dispose() { - m_paragraph.reset(); + m_paragraph_.reset(); ClearDartWrapper(); } diff --git a/lib/ui/text/paragraph.h b/lib/ui/text/paragraph.h index 7f069b7efddab..f47a20a5c046d 100644 --- a/lib/ui/text/paragraph.h +++ b/lib/ui/text/paragraph.h @@ -54,7 +54,7 @@ class Paragraph : public RefCountedDartWrappable { void dispose(); private: - std::unique_ptr m_paragraph; + std::unique_ptr m_paragraph_; explicit Paragraph(std::unique_ptr paragraph); }; diff --git a/lib/ui/text/paragraph_builder.cc b/lib/ui/text/paragraph_builder.cc index 1748bf91ff9da..1e84a90debcf8 100644 --- a/lib/ui/text/paragraph_builder.cc +++ b/lib/ui/text/paragraph_builder.cc @@ -301,7 +301,7 @@ ParagraphBuilder::ParagraphBuilder( ->GetFontCollection(); auto impeller_enabled = UIDartState::Current()->IsImpellerEnabled(); - m_paragraphBuilder = txt::ParagraphBuilder::CreateSkiaBuilder( + m_paragraph_builder_ = txt::ParagraphBuilder::CreateSkiaBuilder( style, font_collection.GetFontCollection(), impeller_enabled); } @@ -389,7 +389,7 @@ void ParagraphBuilder::pushStyle(const tonic::Int32List& encoded, // Set to use the properties of the previous style if the property is not // explicitly given. - txt::TextStyle style = m_paragraphBuilder->PeekStyle(); + txt::TextStyle style = m_paragraph_builder_->PeekStyle(); style.half_leading = mask & kTSLeadingDistributionMask; // Only change the style property from the previous value if a new explicitly @@ -492,11 +492,11 @@ void ParagraphBuilder::pushStyle(const tonic::Int32List& encoded, decodeFontVariations(font_variations_data, style.font_variations); } - m_paragraphBuilder->PushStyle(style); + m_paragraph_builder_->PushStyle(style); } void ParagraphBuilder::pop() { - m_paragraphBuilder->Pop(); + m_paragraph_builder_->Pop(); } Dart_Handle ParagraphBuilder::addText(const std::u16string& text) { @@ -514,7 +514,7 @@ Dart_Handle ParagraphBuilder::addText(const std::u16string& text) { return tonic::ToDart("string is not well-formed UTF-16"); } - m_paragraphBuilder->AddText(text); + m_paragraph_builder_->AddText(text); return Dart_Null(); } @@ -528,12 +528,12 @@ void ParagraphBuilder::addPlaceholder(double width, width, height, static_cast(alignment), static_cast(baseline), baseline_offset); - m_paragraphBuilder->AddPlaceholder(placeholder_run); + m_paragraph_builder_->AddPlaceholder(placeholder_run); } void ParagraphBuilder::build(Dart_Handle paragraph_handle) { - Paragraph::Create(paragraph_handle, m_paragraphBuilder->Build()); - m_paragraphBuilder.reset(); + Paragraph::Create(paragraph_handle, m_paragraph_builder_->Build()); + m_paragraph_builder_.reset(); ClearDartWrapper(); } diff --git a/lib/ui/text/paragraph_builder.h b/lib/ui/text/paragraph_builder.h index 6fc7c58ad97aa..4b341a739f026 100644 --- a/lib/ui/text/paragraph_builder.h +++ b/lib/ui/text/paragraph_builder.h @@ -80,7 +80,7 @@ class ParagraphBuilder : public RefCountedDartWrappable { const std::string& locale, bool applyRoundingHack); - std::unique_ptr m_paragraphBuilder; + std::unique_ptr m_paragraph_builder_; }; } // namespace flutter