From dcb55fb8f18abe5f43d260aa67b14b2dc996f992 Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Tue, 11 Jun 2019 08:00:13 +0000 Subject: [PATCH] GCC: move explicit specialization out of RunInfo Explicit specialization in non-namespace scope is not allowed in C++, and GCC breaks build because of that. Move the template specializations out of RunInfo declaration in shape_result_inline_headeres.h to fix the GCC build issue. Bug: 819294 Change-Id: Id083852bcf8e9efbdc911fdad28fd8767d2905d0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1651728 Reviewed-by: Kinuko Yasuda Commit-Queue: José Dapena Paz Cr-Commit-Position: refs/heads/master@{#667901} --- diff --git a/third_party/blink/renderer/platform/fonts/shaping/shape_result_inline_headers.h b/third_party/blink/renderer/platform/fonts/shaping/shape_result_inline_headers.h index 76ee6091..c14d3a0 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/shape_result_inline_headers.h +++ b/third_party/blink/renderer/platform/fonts/shaping/shape_result_inline_headers.h @@ -251,37 +251,6 @@ template struct iterator final {}; - // For non-zero glyph offset array - template <> - struct iterator final { - // The constructor for ShapeResult - explicit iterator(const GlyphOffsetArray& array) - : pointer(array.storage_.get()) { - DCHECK(pointer); - } - - // The constructor for ShapeResultView - explicit iterator(const GlyphDataRange& range) : pointer(range.offsets) { - DCHECK(pointer); - } - - GlyphOffset operator*() const { return *pointer; } - void operator++() { ++pointer; } - - const GlyphOffset* pointer; - }; - - // For zero glyph offset array - template <> - struct iterator final { - explicit iterator(const GlyphOffsetArray& array) { - DCHECK(!array.HasStorage()); - } - explicit iterator(const GlyphDataRange& range) { DCHECK(!range.offsets); } - GlyphOffset operator*() const { return GlyphOffset(); } - void operator++() {} - }; - template iterator GetIterator() const { return iterator(*this); @@ -495,6 +464,37 @@ float width_; }; +// For non-zero glyph offset array +template <> +struct ShapeResult::RunInfo::GlyphOffsetArray::iterator final { + // The constructor for ShapeResult + explicit iterator(const GlyphOffsetArray& array) + : pointer(array.storage_.get()) { + DCHECK(pointer); + } + + // The constructor for ShapeResultView + explicit iterator(const GlyphDataRange& range) : pointer(range.offsets) { + DCHECK(pointer); + } + + GlyphOffset operator*() const { return *pointer; } + void operator++() { ++pointer; } + + const GlyphOffset* pointer; +}; + +// For zero glyph offset array +template <> +struct ShapeResult::RunInfo::GlyphOffsetArray::iterator final { + explicit iterator(const GlyphOffsetArray& array) { + DCHECK(!array.HasStorage()); + } + explicit iterator(const GlyphDataRange& range) { DCHECK(!range.offsets); } + GlyphOffset operator*() const { return GlyphOffset(); } + void operator++() {} +}; + // Find the range of HarfBuzzRunGlyphData for the specified character index // range. This function uses binary search twice, hence O(2 log n). inline ShapeResult::RunInfo::GlyphDataRange